First checkin for OpenMesh 2.0

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@2 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
Jan Möbius
2009-02-06 13:37:46 +00:00
parent c3321ebdd9
commit 97f515985d
417 changed files with 76182 additions and 0 deletions

18
Tools/VDPM/ACGMakefile Normal file
View File

@@ -0,0 +1,18 @@
#== SYSTEM PART -- DON'T TOUCH ==============================================
include $(ACGMAKE)/Config
#==============================================================================
CXX_CFLAGS += -DQT_THREAD_SUPPORT
SUBDIRS = $(call find-subdirs)
PACKAGES := qt glut opengl x11 math
PROJ_LIBS = OpenMesh/Core
MODULES := cxxlib
#== SYSTEM PART -- DON'T TOUCH ==============================================
include $(ACGMAKE)/Rules
#==============================================================================

102
Tools/VDPM/MeshTraits.hh Normal file
View File

@@ -0,0 +1,102 @@
/*===========================================================================*\
* *
* OpenMesh *
* Copyright (C) 2001-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. *
* *
\*===========================================================================*/
//=============================================================================
//
// CLASS VDPMTraits
//
//=============================================================================
#ifndef OPENMESH_VDPM_TRAITS_HH
#define OPENMESH_VDPM_TRAITS_HH
//== INCLUDES =================================================================
#include <OpenMesh/Core/System/config.h>
#include <OpenMesh/Core/Mesh/Traits.hh>
#include <OpenMesh/Tools/VDPM/VHierarchy.hh>
//== FORWARDDECLARATIONS ======================================================
//== NAMESPACES ===============================================================
namespace OpenMesh {
namespace VDPM {
//== CLASS DEFINITION =========================================================
/** \class MeshTraits MeshTraits.hh <OpenMesh/Tools/VDPM/MeshTraits.hh>
Mesh traits for View Dependent Progressive Meshes
*/
struct MeshTraits : public DefaultTraits
{
VertexTraits
{
public:
VHierarchyNodeHandle vhierarchy_node_handle()
{
return node_handle_;
}
void set_vhierarchy_node_handle(VHierarchyNodeHandle _node_handle)
{
node_handle_ = _node_handle;
}
bool is_ancestor(const VHierarchyNodeIndex &_other)
{
return false;
}
private:
VHierarchyNodeHandle node_handle_;
};
VertexAttributes(OpenMesh::Attributes::Status |
OpenMesh::Attributes::Normal);
HalfedgeAttributes(OpenMesh::Attributes::PrevHalfedge);
EdgeAttributes(OpenMesh::Attributes::Status);
FaceAttributes(OpenMesh::Attributes::Status |
OpenMesh::Attributes::Normal);
};
//=============================================================================
} // namespace VDPM
} // namespace OpenMesh
//=============================================================================
#endif // OPENMESH_VDPM_TRAITS_HH defined
//=============================================================================

View File

@@ -0,0 +1,72 @@
/*===========================================================================*\
* *
* OpenMesh *
* Copyright (C) 2001-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. *
* *
\*===========================================================================*/
//=============================================================================
//
// CLASS newClass
//
//=============================================================================
#ifndef OPENMESH_VDPM_STREAMINGDEF_HH
#define OPENMESH_VDPM_STREAMINGDEF_HH
//== INCLUDES =================================================================
//== FORWARDDECLARATIONS ======================================================
//== NAMESPACES ===============================================================
namespace OpenMesh {
namespace VDPM {
//== CLASS DEFINITION =========================================================
#define VDPM_STREAMING_PORT 4096
#define DEBUG_COUT
//#define QDATASTREAM
#ifdef DEBUG_COUT
static bool debug_print_;
static bool debug_print() { return debug_print_; }
static void set_debug_print(bool flag) { debug_print_ = flag; }
#endif
enum VDPMDownLinkStatus { kStarted, kFinished, kStartable };
enum VDPMStreamingPhase { kBaseMesh, kVSplitHeader, kVSplits };
enum VDPMClientMode { kStatic, kDynamic };
enum VHierarchySearchMode { kBruteForce, kUseHashing };
//=============================================================================
} // namespace VDPM
} // namespace OpenMesh
//=============================================================================
#endif // OPENMESH_VDPROGMESH_VDPMSTREAMINGDEF_HH defined
//=============================================================================

95
Tools/VDPM/VFront.cc Normal file
View File

@@ -0,0 +1,95 @@
/*===========================================================================*\
* *
* OpenMesh *
* Copyright (C) 2001-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. *
* *
\*===========================================================================*/
//=============================================================================
//
// CLASS newClass - IMPLEMENTATION
//
//=============================================================================
//== INCLUDES =================================================================
#include <OpenMesh/Tools/VDPM/VFront.hh>
//== NAMESPACES ===============================================================
namespace OpenMesh {
namespace VDPM {
//== IMPLEMENTATION ==========================================================
VFront::VFront()
{
}
void
VFront::
add(VHierarchyNodeHandle _node_handle)
{
front_location_[_node_handle.idx()] = front_.insert(front_.end(), _node_handle);
}
void
VFront::
remove(VHierarchyNodeHandle _node_handle)
{
VHierarchyNodeHandleListIter node_it = front_location_[_node_handle.idx()];
VHierarchyNodeHandleListIter next_it = front_.erase(node_it);
front_location_[_node_handle.idx()] = front_.end();
if (front_it_ == node_it)
front_it_ = next_it;
}
bool
VFront::
is_active(VHierarchyNodeHandle _node_handle)
{
return (front_location_[_node_handle.idx()] != front_.end()) ? true : false;
}
void
VFront::
init(VHierarchyNodeHandleContainer &_roots, unsigned int _n_details)
{
unsigned int i;
front_location_.resize(_roots.size() + 2*_n_details);
for (i=0; i<front_location_.size(); ++i)
front_location_[i] = front_.end();
for (i=0; i<_roots.size(); ++i)
add(_roots[i]);
}
//=============================================================================
} // namespace VDPM
} // namespace OpenMesh
//=============================================================================

91
Tools/VDPM/VFront.hh Normal file
View File

@@ -0,0 +1,91 @@
/*===========================================================================*\
* *
* OpenMesh *
* Copyright (C) 2001-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. *
* *
\*===========================================================================*/
//=============================================================================
//
// CLASS newClass
//
//=============================================================================
#ifndef OPENMESH_VDPROGMESH_VFRONT_HH
#define OPENMESH_VDPROGMESH_VFRONT_HH
//== INCLUDES =================================================================
#include <OpenMesh/Core/System/config.h>
#include <OpenMesh/Tools/VDPM/VHierarchyNode.hh>
#include <vector>
//== FORWARDDECLARATIONS ======================================================
//== NAMESPACES ===============================================================
namespace OpenMesh {
namespace VDPM {
//== CLASS DEFINITION =========================================================
/** Active nodes in vertex hierarchy.
\todo VFront documentation
*/
class VFront
{
private:
typedef VHierarchyNodeHandleList::iterator VHierarchyNodeHandleListIter;
enum VHierarchyNodeStatus { kSplit, kActive, kCollapse };
VHierarchyNodeHandleList front_;
VHierarchyNodeHandleListIter front_it_;
std::vector<VHierarchyNodeHandleListIter> front_location_;
public:
VFront();
void clear() { front_.clear(); front_location_.clear(); }
void begin() { front_it_ = front_.begin(); }
bool end() { return (front_it_ == front_.end()) ? true : false; }
void next() { ++front_it_; }
int size() { return (int) front_.size(); }
VHierarchyNodeHandle node_handle() { return *front_it_; }
void add(VHierarchyNodeHandle _node_handle);
void remove(VHierarchyNodeHandle _node_handle);
bool is_active(VHierarchyNodeHandle _node_handle);
void init(VHierarchyNodeHandleContainer &_roots, unsigned int _n_details);
};
//=============================================================================
} // namespace VDPM
} // namespace OpenMesh
//=============================================================================
#endif // OPENMESH_VDPROGMESH_VFRONT_HH defined
//=============================================================================

156
Tools/VDPM/VHierarchy.cc Normal file
View File

@@ -0,0 +1,156 @@
/*===========================================================================*\
* *
* OpenMesh *
* Copyright (C) 2001-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. *
* *
\*===========================================================================*/
//=============================================================================
//
// CLASS newClass - IMPLEMENTATION
//
//=============================================================================
//== INCLUDES =================================================================
#include <OpenMesh/Tools/VDPM/VHierarchy.hh>
//== NAMESPACES ===============================================================
namespace OpenMesh {
namespace VDPM {
//== IMPLEMENTATION ==========================================================
VHierarchy::
VHierarchy()
{
clear();
}
void
VHierarchy::
set_num_roots(unsigned int _n_roots)
{
n_roots_ = _n_roots;
tree_id_bits_ = 0;
while (n_roots_ > ((unsigned int) 0x00000001 << tree_id_bits_))
++tree_id_bits_;
}
VHierarchyNodeHandle
VHierarchy::
add_node()
{
return add_node(VHierarchyNode());
}
VHierarchyNodeHandle
VHierarchy::
add_node(const VHierarchyNode &_node)
{
nodes_.push_back(_node);
return VHierarchyNodeHandle(nodes_.size() - 1);
}
void
VHierarchy::
make_children(VHierarchyNodeHandle &_parent_handle)
{
VHierarchyNodeHandle lchild_handle = add_node();
VHierarchyNodeHandle rchild_handle = add_node();
VHierarchyNode &parent = node(_parent_handle);
VHierarchyNode &lchild = node(lchild_handle);
VHierarchyNode &rchild = node(rchild_handle);
parent.set_children_handle(lchild_handle);
lchild.set_parent_handle(_parent_handle);
rchild.set_parent_handle(_parent_handle);
lchild.set_index(VHierarchyNodeIndex(parent.node_index().tree_id(tree_id_bits_), 2*parent.node_index().node_id(tree_id_bits_), tree_id_bits_));
rchild.set_index(VHierarchyNodeIndex(parent.node_index().tree_id(tree_id_bits_), 2*parent.node_index().node_id(tree_id_bits_)+1, tree_id_bits_));
}
VHierarchyNodeHandle
VHierarchy::
node_handle(VHierarchyNodeIndex _node_index)
{
if (_node_index.is_valid(tree_id_bits_) != true)
return InvalidVHierarchyNodeHandle;
VHierarchyNodeHandle node_handle = root_handle(_node_index.tree_id(tree_id_bits_));
unsigned int node_id = _node_index.node_id(tree_id_bits_);
unsigned int flag = 0x80000000;
while (!(node_id & flag)) flag >>= 1;
flag >>= 1;
while (flag > 0 && is_leaf_node(node_handle) != true)
{
if (node_id & flag) // 1: rchild
{
node_handle = rchild_handle(node_handle);
}
else // 0: lchild
{
node_handle = lchild_handle(node_handle);
}
flag >>= 1;
}
return node_handle;
}
bool
VHierarchy::
is_ancestor(VHierarchyNodeIndex _ancestor_index, VHierarchyNodeIndex _descendent_index)
{
if (_ancestor_index.tree_id(tree_id_bits_) != _descendent_index.tree_id(tree_id_bits_))
return false;
unsigned int ancestor_node_id = _ancestor_index.node_id(tree_id_bits_);
unsigned int descendent_node_id = _descendent_index.node_id(tree_id_bits_);
if (ancestor_node_id > descendent_node_id)
return false;
while (descendent_node_id > 0)
{
if (ancestor_node_id == descendent_node_id)
return true;
descendent_node_id >>= 1; // descendent_node_id /= 2
}
return false;
}
//=============================================================================
} // namespace VDPM
} // namespace OpenMesh
//=============================================================================

170
Tools/VDPM/VHierarchy.hh Normal file
View File

@@ -0,0 +1,170 @@
/*===========================================================================*\
* *
* OpenMesh *
* Copyright (C) 2001-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. *
* *
\*===========================================================================*/
//=============================================================================
//
// CLASS newClass
//
//=============================================================================
#ifndef OPENMESH_VDPROGMESH_VHIERARCHY_HH
#define OPENMESH_VDPROGMESH_VHIERARCHY_HH
//== INCLUDES =================================================================
#include <vector>
#include <OpenMesh/Tools/VDPM/VHierarchyNode.hh>
//== FORWARDDECLARATIONS ======================================================
//== NAMESPACES ===============================================================
namespace OpenMesh {
namespace VDPM {
//== CLASS DEFINITION =========================================================
/** Keeps the vertex hierarchy build during analyzing a progressive mesh.
*/
class VHierarchy
{
public:
typedef unsigned int id_t; ///< Type for tree and node ids
private:
VHierarchyNodeContainer nodes_;
unsigned int n_roots_;
unsigned char tree_id_bits_; // node_id_bits_ = 32-tree_id_bits_;
public:
VHierarchy();
void clear() { nodes_.clear(); n_roots_ = 0; }
unsigned char tree_id_bits() const { return tree_id_bits_; }
unsigned int num_roots() const { return n_roots_; }
unsigned int num_nodes() const { return nodes_.size(); }
VHierarchyNodeIndex generate_node_index(id_t _tree_id, id_t _node_id)
{
return VHierarchyNodeIndex(_tree_id, _node_id, tree_id_bits_);
}
void set_num_roots(unsigned int _n_roots);
VHierarchyNodeHandle root_handle(unsigned int i) const
{
return VHierarchyNodeHandle( (int)i );
}
const VHierarchyNode& node(VHierarchyNodeHandle _vhierarchynode_handle) const
{
return nodes_[_vhierarchynode_handle.idx()];
}
VHierarchyNode& node(VHierarchyNodeHandle _vhierarchynode_handle)
{
return nodes_[_vhierarchynode_handle.idx()];
}
VHierarchyNodeHandle add_node();
VHierarchyNodeHandle add_node(const VHierarchyNode &_node);
void make_children(VHierarchyNodeHandle &_parent_handle);
bool is_ancestor(VHierarchyNodeIndex _ancestor_index,
VHierarchyNodeIndex _descendent_index);
bool is_leaf_node(VHierarchyNodeHandle _node_handle)
{ return nodes_[_node_handle.idx()].is_leaf(); }
bool is_root_node(VHierarchyNodeHandle _node_handle)
{ return nodes_[_node_handle.idx()].is_root(); }
const OpenMesh::Vec3f& normal(VHierarchyNodeHandle _node_handle) const
{
return nodes_[_node_handle.idx()].normal();
}
const VHierarchyNodeIndex&
node_index(VHierarchyNodeHandle _node_handle) const
{ return nodes_[_node_handle.idx()].node_index(); }
VHierarchyNodeIndex& node_index(VHierarchyNodeHandle _node_handle)
{ return nodes_[_node_handle.idx()].node_index(); }
const VHierarchyNodeIndex&
fund_lcut_index(VHierarchyNodeHandle _node_handle) const
{ return nodes_[_node_handle.idx()].fund_lcut_index(); }
VHierarchyNodeIndex& fund_lcut_index(VHierarchyNodeHandle _node_handle)
{ return nodes_[_node_handle.idx()].fund_lcut_index(); }
const VHierarchyNodeIndex&
fund_rcut_index(VHierarchyNodeHandle _node_handle) const
{ return nodes_[_node_handle.idx()].fund_rcut_index(); }
VHierarchyNodeIndex& fund_rcut_index(VHierarchyNodeHandle _node_handle)
{ return nodes_[_node_handle.idx()].fund_rcut_index(); }
VertexHandle vertex_handle(VHierarchyNodeHandle _node_handle)
{ return nodes_[_node_handle.idx()].vertex_handle(); }
VHierarchyNodeHandle parent_handle(VHierarchyNodeHandle _node_handle)
{ return nodes_[_node_handle.idx()].parent_handle(); }
VHierarchyNodeHandle lchild_handle(VHierarchyNodeHandle _node_handle)
{ return nodes_[_node_handle.idx()].lchild_handle(); }
VHierarchyNodeHandle rchild_handle(VHierarchyNodeHandle _node_handle)
{ return nodes_[_node_handle.idx()].rchild_handle(); }
VHierarchyNodeHandle node_handle(VHierarchyNodeIndex _node_index);
private:
VHierarchyNodeHandle compute_dependency(VHierarchyNodeIndex index0,
VHierarchyNodeIndex index1);
};
//=============================================================================
} // namespace VDPM
} // namespace OpenMesh
//=============================================================================
#endif // OPENMESH_VDPROGMESH_VHIERARCHY_HH defined
//=============================================================================

View File

@@ -0,0 +1,176 @@
/*===========================================================================*\
* *
* OpenMesh *
* Copyright (C) 2001-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. *
* *
\*===========================================================================*/
//=============================================================================
//
// CLASS newClass
//
//=============================================================================
#ifndef OPENMESH_VDPROGMESH_VHIERARCHYNODE_HH
#define OPENMESH_VDPROGMESH_VHIERARCHYNODE_HH
//== INCLUDES =================================================================
#include <vector>
#include <list>
#include <OpenMesh/Core/Geometry/VectorT.hh>
#include <OpenMesh/Core/Mesh/Handles.hh>
#include <OpenMesh/Tools/VDPM/VHierarchyNodeIndex.hh>
//== FORWARDDECLARATIONS ======================================================
//== NAMESPACES ===============================================================
namespace OpenMesh {
namespace VDPM {
//== CLASS DEFINITION =========================================================
/** Handle for vertex hierarchy nodes
*/
struct VHierarchyNodeHandle : public BaseHandle
{
explicit VHierarchyNodeHandle(int _idx=-1) : BaseHandle(_idx) {}
};
/// Invalid handle
static const VHierarchyNodeHandle InvalidVHierarchyNodeHandle;
/** Vertex hierarchy node
* \todo Complete documentation
*/
class VHierarchyNode
{
public:
VHierarchyNode() { }
/// Returns true, if node is root else false.
bool is_root() const
{ return (parent_handle_.is_valid() == false) ? true : false; }
/// Returns true, if node is leaf else false.
bool is_leaf() const
{ return (lchild_handle_.is_valid() == false) ? true : false; }
/// Returns parent handle.
VHierarchyNodeHandle parent_handle() { return parent_handle_; }
/// Returns handle to left child.
VHierarchyNodeHandle lchild_handle() { return lchild_handle_; }
/// Returns handle to right child.
VHierarchyNodeHandle rchild_handle()
{ return VHierarchyNodeHandle(lchild_handle_.idx()+1); }
void set_parent_handle(VHierarchyNodeHandle _parent_handle)
{ parent_handle_ = _parent_handle; }
void set_children_handle(VHierarchyNodeHandle _lchild_handle)
{ lchild_handle_ = _lchild_handle; }
VertexHandle vertex_handle() const { return vh_; }
float radius() const { return radius_; }
const OpenMesh::Vec3f& normal() const { return normal_; }
float sin_square() const { return sin_square_; }
float mue_square() const { return mue_square_; }
float sigma_square() const { return sigma_square_; }
void set_vertex_handle(OpenMesh::VertexHandle _vh) { vh_ = _vh; }
void set_radius(float _radius) { radius_ = _radius; }
void set_normal(const OpenMesh::Vec3f &_normal) { normal_ = _normal; }
void set_sin_square(float _sin_square) { sin_square_ = _sin_square; }
void set_mue_square(float _mue_square) { mue_square_ = _mue_square; }
void set_sigma_square(float _sigma_square) { sigma_square_ = _sigma_square; }
void set_semi_angle(float _semi_angle)
{ float f=sinf(_semi_angle); sin_square_ = f*f; }
void set_mue(float _mue) { mue_square_ = _mue * _mue; }
void set_sigma(float _sigma) { sigma_square_ = _sigma * _sigma; }
const VHierarchyNodeIndex& node_index() const { return node_index_; }
const VHierarchyNodeIndex& fund_lcut_index() const
{ return fund_cut_node_index_[0]; }
const VHierarchyNodeIndex& fund_rcut_index() const
{ return fund_cut_node_index_[1]; }
VHierarchyNodeIndex& node_index()
{ return node_index_; }
VHierarchyNodeIndex& fund_lcut_index() { return fund_cut_node_index_[0]; }
VHierarchyNodeIndex& fund_rcut_index() { return fund_cut_node_index_[1]; }
void set_index(const VHierarchyNodeIndex &_node_index)
{ node_index_ = _node_index; }
void set_fund_lcut(const VHierarchyNodeIndex &_node_index)
{ fund_cut_node_index_[0] = _node_index; }
void set_fund_rcut(const VHierarchyNodeIndex &_node_index)
{ fund_cut_node_index_[1] = _node_index; }
private:
VertexHandle vh_;
float radius_;
Vec3f normal_;
float sin_square_;
float mue_square_;
float sigma_square_;
VHierarchyNodeHandle parent_handle_;
VHierarchyNodeHandle lchild_handle_;
VHierarchyNodeIndex node_index_;
VHierarchyNodeIndex fund_cut_node_index_[2];
};
/// Container for vertex hierarchy nodes
typedef std::vector<VHierarchyNode> VHierarchyNodeContainer;
/// Container for vertex hierarchy node handles
typedef std::vector<VHierarchyNodeHandle> VHierarchyNodeHandleContainer;
/// Container for vertex hierarchy node handles
typedef std::list<VHierarchyNodeHandle> VHierarchyNodeHandleList;
//=============================================================================
} // namesapce VDPM
} // namespace OpenMesh
//=============================================================================
#endif // OPENMESH_VDPROGMESH_VHIERARCHYNODE_HH defined
//=============================================================================

View File

@@ -0,0 +1,55 @@
/*===========================================================================*\
* *
* OpenMesh *
* Copyright (C) 2001-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. *
* *
\*===========================================================================*/
//=============================================================================
//
// CLASS newClass - IMPLEMENTATION
//
//=============================================================================
//== INCLUDES =================================================================
#include <OpenMesh/Tools/VDPM/VHierarchyNodeIndex.hh>
//== NAMESPACES ===============================================================
namespace OpenMesh {
namespace VDPM {
//== IMPLEMENTATION ==========================================================
const VHierarchyNodeIndex
VHierarchyNodeIndex::InvalidIndex = VHierarchyNodeIndex();
//=============================================================================
} // namespace VDPM
} // namespace OpenMesh
//=============================================================================

View File

@@ -0,0 +1,110 @@
/*===========================================================================*\
* *
* OpenMesh *
* Copyright (C) 2001-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. *
* *
\*===========================================================================*/
//=============================================================================
//
// CLASS newClass
//
//=============================================================================
#ifndef OPENMESH_VDPROGMESH_VHIERARCHYNODEINDEX_HH
#define OPENMESH_VDPROGMESH_VHIERARCHYNODEINDEX_HH
//== INCLUDES =================================================================
#include <vector>
#include <assert.h>
//== FORWARDDECLARATIONS ======================================================
//== NAMESPACES ===============================================================
namespace OpenMesh {
namespace VDPM {
//== CLASS DEFINITION =========================================================
/** Index of vertex hierarchy node
*/
class VHierarchyNodeIndex
{
private:
unsigned int value_;
public:
static const VHierarchyNodeIndex InvalidIndex;
public:
VHierarchyNodeIndex()
{ value_ = 0; }
VHierarchyNodeIndex(unsigned int _value)
{ value_ = _value; }
VHierarchyNodeIndex(const VHierarchyNodeIndex &_other)
{ value_ = _other.value_; }
VHierarchyNodeIndex(unsigned int _tree_id,
unsigned int _node_id,
unsigned short _tree_id_bits)
{
assert(_tree_id < ((unsigned int) 0x00000001 << _tree_id_bits));
assert(_node_id < ((unsigned int) 0x00000001 << (32 - _tree_id_bits)));
value_ = (_tree_id << (32 - _tree_id_bits)) | _node_id;
}
bool is_valid(unsigned short _tree_id_bits) const
{ return node_id(_tree_id_bits) != 0 ? true : false; }
unsigned int tree_id(unsigned short _tree_id_bits) const
{ return value_ >> (32 - _tree_id_bits); }
unsigned int node_id(unsigned short _tree_id_bits) const
{ return value_ & ((unsigned int) 0xFFFFFFFF >> _tree_id_bits); }
bool operator< (const VHierarchyNodeIndex &other) const
{ return (value_ < other.value_) ? true : false; }
unsigned int value() const
{ return value_; }
};
/// Container for vertex hierarchy node indices
typedef std::vector<VHierarchyNodeIndex> VHierarchyNodeIndexContainer;
//=============================================================================
} // namespace VDPM
} // namespace OpenMesh
//=============================================================================
#endif // OPENMESH_VDPROGMESH_VHIERARCHYNODEINDEX_HH defined
//=============================================================================

View File

@@ -0,0 +1,188 @@
/*===========================================================================*\
* *
* OpenMesh *
* Copyright (C) 2001-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. *
* *
\*===========================================================================*/
//=============================================================================
//
// CLASS newClass - IMPLEMENTATION
//
//=============================================================================
//== INCLUDES =================================================================
#include <OpenMesh/Tools/VDPM/VHierarchyWindow.hh>
#ifndef WIN32
#include <string.h>
#include <cstdlib>
#endif
//== NAMESPACES ===============================================================
namespace OpenMesh {
namespace VDPM {
//== IMPLEMENTATION ==========================================================
VHierarchyWindow::
VHierarchyWindow()
{
vhierarchy_ = NULL;
buffer_ = NULL;
buffer_min_ = 0;
buffer_max_ = 0;
window_min_ = 0;
window_max_ = 0;
current_pos_ = 0;
n_shift_ = 0;
}
VHierarchyWindow::
VHierarchyWindow(VHierarchy &_vhierarchy)
{
vhierarchy_ = &_vhierarchy;
buffer_ = NULL;
}
VHierarchyWindow::
~VHierarchyWindow(void)
{
if (buffer_ != NULL)
free(buffer_);
}
bool
VHierarchyWindow::
update_buffer(VHierarchyNodeHandle _node_handle)
{
if (underflow(_node_handle) != true && overflow(_node_handle) != true)
return false;
// tightly update window_min_ & window_max_
int none_zero_pos;
for (none_zero_pos=buffer_size()-1; none_zero_pos >= 0; --none_zero_pos)
{
if (buffer_[none_zero_pos] != 0) break;
}
window_max_ = buffer_min_ + none_zero_pos + 1;
for(none_zero_pos=0; none_zero_pos < buffer_size(); ++none_zero_pos)
{
if (buffer_[none_zero_pos] != 0) break;
}
window_min_ = buffer_min_ + none_zero_pos;
assert(window_min_ < window_max_);
while (underflow(_node_handle) == true) buffer_min_ /= 2;
while (overflow(_node_handle) == true)
{
buffer_max_ *= 2;
if (buffer_max_ > (int) vhierarchy_->num_nodes() / 8)
buffer_max_ = (int) (1 + vhierarchy_->num_nodes() / 8);
}
unsigned char *new_buffer = (unsigned char *) malloc(buffer_size());
memset(new_buffer, 0, buffer_size());
memcpy(&(new_buffer[window_min_-buffer_min_]),
&(buffer_[none_zero_pos]),
window_size());
free(buffer_);
buffer_ = new_buffer;
return true;
}
void
VHierarchyWindow::init(VHierarchyNodeHandleContainer &_roots)
{
if (buffer_ != NULL)
free(buffer_);
buffer_min_ = 0;
buffer_max_ = _roots.size() / 8;
if (_roots.size() % 8 > 0)
++buffer_max_;
buffer_ = (unsigned char *) malloc(buffer_size());
memset(buffer_, 0, buffer_size());
window_min_ = 0;
window_max_= 0;
current_pos_ = 0;
n_shift_ = 0;
for (unsigned int i=0; i<_roots.size(); i++)
{
activate(VHierarchyNodeHandle((int) i));
}
}
void
VHierarchyWindow::
update_with_vsplit(VHierarchyNodeHandle _parent_handle)
{
VHierarchyNodeHandle
lchild_handle = vhierarchy_->lchild_handle(_parent_handle),
rchild_handle = vhierarchy_->rchild_handle(_parent_handle);
assert(is_active(_parent_handle) == true);
assert(is_active(lchild_handle) != true);
assert(is_active(rchild_handle) != true);
inactivate(_parent_handle);
activate(rchild_handle);
activate(lchild_handle);
}
void
VHierarchyWindow::
update_with_ecol(VHierarchyNodeHandle _parent_handle)
{
VHierarchyNodeHandle
lchild_handle = vhierarchy_->lchild_handle(_parent_handle),
rchild_handle = vhierarchy_->rchild_handle(_parent_handle);
assert(is_active(_parent_handle) != true);
assert(is_active(lchild_handle) == true);
assert(is_active(rchild_handle) == true);
activate(_parent_handle);
inactivate(rchild_handle);
inactivate(lchild_handle);
}
//=============================================================================
} // namespace VDPM
} // namespace OpenMesh
//=============================================================================

View File

@@ -0,0 +1,201 @@
/*===========================================================================*\
* *
* OpenMesh *
* Copyright (C) 2001-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. *
* *
\*===========================================================================*/
//=============================================================================
//
// CLASS newClass
//
//=============================================================================
#ifndef OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH
#define OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH
//== INCLUDES =================================================================
#include <OpenMesh/Tools/VDPM/VHierarchy.hh>
//== FORWARDDECLARATIONS ======================================================
//== NAMESPACES ===============================================================
namespace OpenMesh {
namespace VDPM {
//== CLASS DEFINITION =========================================================
/** \todo VHierarchyWindow documentation
*/
class VHierarchyWindow
{
private:
// reference of vertex hierarchy
VHierarchy *vhierarchy_;
// bits buffer (byte units)
unsigned char *buffer_;
int buffer_min_;
int buffer_max_;
int current_pos_;
// window (byte units)
int window_min_;
int window_max_;
// # of right shift (bit units)
unsigned char n_shift_; // [0, 7]
unsigned char flag8(unsigned char n_shift) const
{ return 0x80 >> n_shift; }
unsigned char flag8(VHierarchyNodeHandle _node_handle) const
{
assert(_node_handle.idx() >= 0);
return 0x80 >> (unsigned int) (_node_handle.idx() % 8);
}
int byte_idx(VHierarchyNodeHandle _node_handle) const
{
assert(_node_handle.idx() >= 0);
return _node_handle.idx() / 8;
}
int buffer_idx(VHierarchyNodeHandle _node_handle) const
{ return byte_idx(_node_handle) - buffer_min_; }
bool before_window(VHierarchyNodeHandle _node_handle) const
{ return (_node_handle.idx()/8 < window_min_) ? true : false; }
bool after_window(VHierarchyNodeHandle _node_handle) const
{ return (_node_handle.idx()/8 < window_max_) ? false : true; }
bool underflow(VHierarchyNodeHandle _node_handle) const
{ return (_node_handle.idx()/8 < buffer_min_) ? true : false; }
bool overflow(VHierarchyNodeHandle _node_handle) const
{ return (_node_handle.idx()/8 < buffer_max_) ? false : true; }
bool update_buffer(VHierarchyNodeHandle _node_handle);
public:
VHierarchyWindow();
VHierarchyWindow(VHierarchy &_vhierarchy);
~VHierarchyWindow(void);
void set_vertex_hierarchy(VHierarchy &_vhierarchy)
{ vhierarchy_ = &_vhierarchy; }
void begin()
{
int new_window_min = window_min_;
for (current_pos_=window_min_-buffer_min_;
current_pos_ < window_size(); ++current_pos_)
{
if (buffer_[current_pos_] == 0)
++new_window_min;
else
{
n_shift_ = 0;
while ((buffer_[current_pos_] & flag8(n_shift_)) == 0)
++n_shift_;
break;
}
}
window_min_ = new_window_min;
}
void next()
{
++n_shift_;
if (n_shift_ == 8)
{
n_shift_ = 0;
++current_pos_;
}
while (current_pos_ < window_max_-buffer_min_)
{
if (buffer_[current_pos_] != 0) // if the current byte has non-zero bits
{
while (n_shift_ != 8)
{
if ((buffer_[current_pos_] & flag8(n_shift_)) != 0)
return; // find 1 bit in the current byte
++n_shift_;
}
}
n_shift_ = 0;
++current_pos_;
}
}
bool end() { return !(current_pos_ < window_max_-buffer_min_); }
int window_size() const { return window_max_ - window_min_; }
int buffer_size() const { return buffer_max_ - buffer_min_; }
VHierarchyNodeHandle node_handle()
{
return VHierarchyNodeHandle(8*(buffer_min_+current_pos_) + (int)n_shift_);
}
void activate(VHierarchyNodeHandle _node_handle)
{
update_buffer(_node_handle);
buffer_[buffer_idx(_node_handle)] |= flag8(_node_handle);
window_min_ = std::min(window_min_, byte_idx(_node_handle));
window_max_ = std::max(window_max_, 1+byte_idx(_node_handle));
}
void inactivate(VHierarchyNodeHandle _node_handle)
{
if (is_active(_node_handle) != true) return;
buffer_[buffer_idx(_node_handle)] ^= flag8(_node_handle);
}
bool is_active(VHierarchyNodeHandle _node_handle) const
{
if (before_window(_node_handle) == true ||
after_window(_node_handle) == true)
return false;
return ((buffer_[buffer_idx(_node_handle)] & flag8(_node_handle)) > 0);
}
void init(VHierarchyNodeHandleContainer &_roots);
void update_with_vsplit(VHierarchyNodeHandle _parent_handle);
void update_with_ecol(VHierarchyNodeHandle _parent_handle);
};
//=============================================================================
} // namespace VDPM
} // namespace OpenMesh
//=============================================================================
#endif // OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH
//=============================================================================

View File

@@ -0,0 +1,142 @@
/*===========================================================================*\
* *
* OpenMesh *
* Copyright (C) 2001-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. *
* *
\*===========================================================================*/
//=============================================================================
//
// CLASS newClass - IMPLEMENTATION
//
//=============================================================================
//== INCLUDES =================================================================
#include <OpenMesh/Tools/VDPM/ViewingParameters.hh>
//== NAMESPACES ===============================================================
namespace OpenMesh {
namespace VDPM {
//== IMPLEMENTATION ==========================================================
ViewingParameters::
ViewingParameters()
{
fovy_ = 45.0f;
aspect_ = 1.0f;
tolerance_square_ = 0.001f;
}
void
ViewingParameters::
update_viewing_configurations()
{
// |a11 a12 a13|-1 | a33a22-a32a23 -(a33a12-a32a13) a23a12-a22a13 |
// |a21 a22 a23| = 1/DET*|-(a33a21-a31a23) a33a11-a31a13 -(a23a11-a21a13)|
// |a31 a32 a33| | a32a21-a31a22 -(a32a11-a31a12) a22a11-a21a12 |
// DET = a11(a33a22-a32a23)-a21(a33a12-a32a13)+a31(a23a12-a22a13)
float invdet;
float a11, a12, a13, a21, a22, a23, a31, a32, a33;
Vec3f inv_rot[3], trans;
a11 = (float) modelview_matrix_[0];
a12 = (float) modelview_matrix_[4];
a13 = (float) modelview_matrix_[8];
trans[0] = (float) modelview_matrix_[12];
a21 = (float) modelview_matrix_[1];
a22 = (float) modelview_matrix_[5];
a23 = (float) modelview_matrix_[9];
trans[1] = (float) modelview_matrix_[13];
a31 = (float) modelview_matrix_[2];
a32 = (float) modelview_matrix_[6];
a33 = (float) modelview_matrix_[10];
trans[2] = (float) modelview_matrix_[14];
invdet=a11*(a33*a22-a32*a23) - a21*(a33*a12-a32*a13) + a31*(a23*a12-a22*a13);
invdet= (float) 1.0/invdet;
(inv_rot[0])[0] = (a33*a22-a32*a23) * invdet;
(inv_rot[0])[1] = -(a33*a12-a32*a13) * invdet;
(inv_rot[0])[2] = (a23*a12-a22*a13) * invdet;
(inv_rot[1])[0] = -(a33*a21-a31*a23) * invdet;
(inv_rot[1])[1] = (a33*a11-a31*a13) * invdet;
(inv_rot[1])[2] = -(a23*a11-a21*a13) * invdet;
(inv_rot[2])[0] = (a32*a21-a31*a22) * invdet;
(inv_rot[2])[1] = -(a32*a11-a31*a12) * invdet;
(inv_rot[2])[2] = (a22*a11-a21*a12) * invdet;
eye_pos_ = - Vec3f(dot(inv_rot[0], trans),
dot(inv_rot[1], trans),
dot(inv_rot[2], trans));
right_dir_ = Vec3f(a11, a12, a13);
up_dir_ = Vec3f(a21, a22, a23);
view_dir_ = - Vec3f(a31, a32, a33);
Vec3f normal[4];
//float aspect = width() / height();
float half_theta = fovy() * 0.5f;
float half_phi = atanf(aspect() * tanf(half_theta));
float sin1 = sinf(half_theta);
float cos1 = cosf(half_theta);
float sin2 = sinf(half_phi);
float cos2 = cosf(half_phi);
normal[0] = cos2 * right_dir_ + sin2 * view_dir_;
normal[1] = -cos1 * up_dir_ - sin1 * view_dir_;
normal[2] = -cos2 * right_dir_ + sin2 * view_dir_;
normal[3] = cos1 * up_dir_ - sin1 * view_dir_;
for (int i=0; i<4; i++)
frustum_plane_[i] = Plane3d(normal[i], eye_pos_);
}
void
ViewingParameters::
PrintOut()
{
std::cout << " ModelView matrix: " << std::endl;
std::cout << " |" << modelview_matrix_[0] << " " << modelview_matrix_[4] << " " << modelview_matrix_[8] << " " << modelview_matrix_[12] << "|" << std::endl;
std::cout << " |" << modelview_matrix_[1] << " " << modelview_matrix_[5] << " " << modelview_matrix_[9] << " " << modelview_matrix_[13] << "|" << std::endl;
std::cout << " |" << modelview_matrix_[2] << " " << modelview_matrix_[6] << " " << modelview_matrix_[10] << " " << modelview_matrix_[14] << "|" << std::endl;
std::cout << " |" << modelview_matrix_[3] << " " << modelview_matrix_[7] << " " << modelview_matrix_[11] << " " << modelview_matrix_[15] << "|" << std::endl;
std::cout << " Fovy: " << fovy_ << std::endl;
std::cout << " Aspect: " << aspect_ << std::endl;
std::cout << " Tolerance^2: " << tolerance_square_ << std::endl;
std::cout << " Eye Pos: " << eye_pos_ << std::endl;
std::cout << " Right dir: " << right_dir_ << std::endl;
std::cout << " Up dir: " << up_dir_ << std::endl;
std::cout << " View dir: " << view_dir_ << std::endl;
}
//=============================================================================
} // namespace VDPM
} // namespace OpenMesh
//=============================================================================

View File

@@ -0,0 +1,124 @@
/*===========================================================================*\
* *
* OpenMesh *
* Copyright (C) 2001-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. *
* *
\*===========================================================================*/
//=============================================================================
//
// CLASS newClass
//
//=============================================================================
#ifndef OPENMESH_VDPROGMESH_VIEWINGPARAMETERS_HH
#define OPENMESH_VDPROGMESH_VIEWINGPARAMETERS_HH
//== INCLUDES =================================================================
#include <OpenMesh/Core/Geometry/VectorT.hh>
#include <OpenMesh/Core/Geometry/Plane3d.hh>
//== FORWARDDECLARATIONS ======================================================
//== NAMESPACES ===============================================================
namespace OpenMesh {
namespace VDPM {
//== CLASS DEFINITION =========================================================
/** \todo ViewerParameters documentation
*/
class ViewingParameters
{
private:
double modelview_matrix_[16];
float fovy_;
float aspect_;
float tolerance_square_;
Vec3f eye_pos_;
Vec3f right_dir_;
Vec3f up_dir_;
Vec3f view_dir_;
Plane3d frustum_plane_[4];
public:
ViewingParameters();
void increase_tolerance() { tolerance_square_ *= 5.0f; }
void decrease_tolerance() { tolerance_square_ /= 5.0f; }
float fovy() const { return fovy_; }
float aspect() const { return aspect_; }
float tolerance_square() const { return tolerance_square_; }
void set_fovy(float _fovy) { fovy_ = _fovy; }
void set_aspect(float _aspect) { aspect_ = _aspect; }
void set_tolerance_square(float _tolerance_square) { tolerance_square_ = _tolerance_square; }
const Vec3f& eye_pos() const { return eye_pos_; }
const Vec3f& right_dir() const { return right_dir_; }
const Vec3f& up_dir() const { return up_dir_; }
const Vec3f& view_dir() const { return view_dir_; }
Vec3f& eye_pos() { return eye_pos_; }
Vec3f& right_dir() { return right_dir_; }
Vec3f& up_dir() { return up_dir_; }
Vec3f& view_dir() { return view_dir_; }
void frustum_planes( Plane3d _plane[4] )
{
for (unsigned int i=0; i<4; ++i)
_plane[i] = frustum_plane_[i];
}
void get_modelview_matrix(double _modelview_matrix[16])
{
for (unsigned int i=0; i<16; ++i)
_modelview_matrix[i] = modelview_matrix_[i];
}
void set_modelview_matrix(const double _modelview_matrix[16])
{
for (unsigned int i=0; i<16; ++i)
modelview_matrix_[i] = _modelview_matrix[i];
}
void update_viewing_configurations();
void PrintOut();
};
//=============================================================================
} // namespace VDPM
} // namespace OpenMesh
//=============================================================================
#endif // OPENMESH_VDPROGMESH_VIEWINGPARAMETERS_HH defined
//=============================================================================

View File

@@ -0,0 +1,22 @@
/* XPM */
static const char *fileopen[] = {
" 16 13 5 1",
". c #040404",
"# c #808304",
"a c None",
"b c #f3f704",
"c c #f3f7f3",
"aaaaaaaaa...aaaa",
"aaaaaaaa.aaa.a.a",
"aaaaaaaaaaaaa..a",
"a...aaaaaaaa...a",
".bcb.......aaaaa",
".cbcbcbcbc.aaaaa",
".bcbcbcbcb.aaaaa",
".cbcb...........",
".bcb.#########.a",
".cb.#########.aa",
".b.#########.aaa",
"..#########.aaaa",
"...........aaaaa"
};

View File

@@ -0,0 +1,24 @@
/* XPM */
static const char *fileprint[] = {
" 16 14 6 1",
". c #000000",
"# c #848284",
"a c #c6c3c6",
"b c #ffff00",
"c c #ffffff",
"d c None",
"ddddd.........dd",
"dddd.cccccccc.dd",
"dddd.c.....c.ddd",
"ddd.cccccccc.ddd",
"ddd.c.....c....d",
"dd.cccccccc.a.a.",
"d..........a.a..",
".aaaaaaaaaa.a.a.",
".............aa.",
".aaaaaa###aa.a.d",
".aaaaaabbbaa...d",
".............a.d",
"d.aaaaaaaaa.a.dd",
"dd...........ddd"
};

View File

@@ -0,0 +1,22 @@
/* XPM */
static const char *filesave[] = {
" 14 14 4 1",
". c #040404",
"# c #808304",
"a c #bfc2bf",
"b c None",
"..............",
".#.aaaaaaaa.a.",
".#.aaaaaaaa...",
".#.aaaaaaaa.#.",
".#.aaaaaaaa.#.",
".#.aaaaaaaa.#.",
".#.aaaaaaaa.#.",
".##........##.",
".############.",
".##.........#.",
".##......aa.#.",
".##......aa.#.",
".##......aa.#.",
"b............."
};