Commit bed8928d authored by Jan Möbius's avatar Jan Möbius

Merge branch 'cleanup-planes' into 'master'

Merge duplicated plane implementatins into ACG

See merge request !16
parents 19d00ec7 613183cd
......@@ -54,6 +54,7 @@
#include <OpenVolumeMesh/Attribs/NormalAttrib.hh>
#include <OpenVolumeMesh/Attribs/ColorAttrib.hh>
#include <OpenVolumeMesh/Attribs/TexCoordAttrib.hh>
#include <ACG/Geometry/Types/PlaneType.hh>
/*! \class VolumeMeshBufferManager
* \brief This class creates buffers that can be used to render open volume meshs.
......@@ -74,6 +75,8 @@ class VolumeMeshBufferManager
typedef OpenVolumeMesh::OpenVolumeMeshFace Face;
typedef OpenVolumeMesh::OpenVolumeMeshCell Cell;
using Plane = ACG::Geometry::Plane;
public:
enum PrimitiveMode
......@@ -118,22 +121,6 @@ public:
TCM_SINGLE_2D
};
class Plane {
public:
Plane(const ACG::Vec3d& _p, const ACG::Vec3d& _n, const ACG::Vec3d& _x, const ACG::Vec3d& _y) :
position(_p), normal(_n), xdirection(_x), ydirection(_y) {
}
// position
ACG::Vec3d position;
// normal
ACG::Vec3d normal;
// xdirection scaled by 1.0/width -> [0,1] is inrange
ACG::Vec3d xdirection;
// ydirection scaled by 1.0/height -> [0,1] is inrange
ACG::Vec3d ydirection;
};
VolumeMeshBufferManager(const VolumeMesh &mesh_, OpenVolumeMesh::StatusAttrib& statusAttrib_,
OpenVolumeMesh::ColorAttrib<ACG::Vec4f>& colorAttrib_,
OpenVolumeMesh::NormalAttrib<VolumeMesh>& normalAttrib_,
......@@ -297,7 +284,7 @@ public:
void clearCutPlanes();
/// Adds a cut plane
void addCutPlane(const typename VolumeMeshBufferManager<VolumeMesh>::Plane& _p);
void addCutPlane(const ACG::Geometry::Plane& _p);
/// Adds a cut plane
void addCutPlane(const ACG::Vec3d& _p, const ACG::Vec3d& _n, const ACG::Vec3d& _xsize, const ACG::Vec3d& _ysize);
......@@ -478,7 +465,7 @@ private:
unsigned char mCurrentNormalOffset;
unsigned char mCurrentColorOffset;
std::vector<Plane> cut_planes_;
std::vector<ACG::Geometry::Plane> cut_planes_;
std::vector<ACG::Vec3d> mCogs;
bool mCogsValid;
......
......@@ -429,7 +429,7 @@ void VolumeMeshBufferManager<VolumeMesh>::clearCutPlanes()
* @param _p The plane that is added.
*/
template <class VolumeMesh>
void VolumeMeshBufferManager<VolumeMesh>::addCutPlane(const typename VolumeMeshBufferManager<VolumeMesh>::Plane& _p)
void VolumeMeshBufferManager<VolumeMesh>::addCutPlane(const ACG::Geometry::Plane& _p)
{
cut_planes_.push_back(_p);
invalidateGeometry();
......@@ -449,7 +449,7 @@ void VolumeMeshBufferManager<VolumeMesh>::addCutPlane(const typename VolumeMeshB
template <class VolumeMesh>
void VolumeMeshBufferManager<VolumeMesh>::addCutPlane(const ACG::Vec3d &_p, const ACG::Vec3d &_n, const ACG::Vec3d &_xsize, const ACG::Vec3d &_ysize)
{
addCutPlane(Plane(_p, _n, _xsize, _ysize));
addCutPlane(ACG::Geometry::Plane(_p, _n, _xsize, _ysize));
}
/**
......@@ -467,8 +467,8 @@ bool VolumeMeshBufferManager<VolumeMesh>::is_inside(const ACG::Vec3d& _p)
ACG::Vec3d pl = _p - it->position;
// evaluate dot products
double pn = (pl | it->normal);
double px = (pl | it->xdirection);
double py = (pl | it->ydirection);
double px = (pl | it->xDirection);
double py = (pl | it->yDirection);
if (pn < 0.0 && px > -0.5 && px < 0.5 && py > -0.5 && py < 0.5)
return false;
......
......@@ -49,6 +49,7 @@
#include <ACG/Scenegraph/BaseNode.hh>
#include <ACG/Scenegraph/MaterialNode.hh>
#include <ACG/Scenegraph/DrawModes.hh>
#include <ACG/Geometry/Types/PlaneType.hh>
#include <OpenVolumeMesh/Core/OpenVolumeMeshHandle.hh>
#include <OpenVolumeMesh/Core/BaseEntities.hh>
#include <OpenVolumeMesh/Attribs/StatusAttrib.hh>
......@@ -94,7 +95,7 @@ public:
typedef OpenVolumeMesh::OpenVolumeMeshFace Face;
typedef OpenVolumeMesh::OpenVolumeMeshCell Cell;
typedef typename VolumeMeshBufferManager<VolumeMeshT>::Plane Plane;
using Plane = ACG::Geometry::Plane;
/// Constructor
......
......@@ -56,6 +56,7 @@
#include <ACG/GL/IRenderer.hh>
#include <ACG/ShaderUtils/GLSLShader.hh>
#include <ACG/GL/ShaderCache.hh>
#include <ACG/Geometry/Types/PlaneType.hh>
#include <OpenVolumeMesh/Mesh/HexahedralMesh.hh>
......@@ -1447,7 +1448,7 @@ template<class VolumeMeshT>
void VolumeMeshNodeT<VolumeMeshT>::add_cut_plane(const Vec3d& _p, const Vec3d& _n, const Vec3d& _xsize,
const Vec3d& _ysize) {
add_cut_plane(VolumeMeshBufferManager<VolumeMeshT>::Plane(_p, _n, _xsize, _ysize));
add_cut_plane(Plane(_p, _n, _xsize, _ysize));
}
template<class VolumeMeshT>
......
......@@ -194,7 +194,6 @@ void TypeHexahedralMeshPlugin::slotUpdateContextMenu(int _objectId) {
void TypeHexahedralMeshPlugin::slot_update_planes_in_scenegraph_node(int _deletedObject) {
typedef ACG::SceneGraph::VolumeMeshNodeT<HexahedralMesh>::Plane Plane;
std::vector<Plane> planes;
// collect planes
......
......@@ -246,7 +246,6 @@ void TypePolyhedralMeshPlugin::setTranslucencyFactor() {
void TypePolyhedralMeshPlugin::slot_update_planes_in_scenegraph_node(int _deletedObject) {
typedef ACG::SceneGraph::VolumeMeshNodeT<PolyhedralMesh>::Plane Plane;
std::vector<Plane> planes;
// collect planes
......
......@@ -180,7 +180,6 @@ void TypeTetrahedralMeshPlugin::slotUpdateContextMenu(int _objectId) {
void TypeTetrahedralMeshPlugin::slot_update_planes_in_scenegraph_node(int _deletedObject) {
typedef ACG::SceneGraph::VolumeMeshNodeT<TetrahedralMesh>::Plane Plane;
std::vector<Plane> planes;
// collect planes
......
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