Commit 5b8bfdcb authored by Jan Möbius's avatar Jan Möbius

Added functions to mesh node to toggle selectionVisibility

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@3001 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 575129eb
This diff is collapsed.
...@@ -12,12 +12,12 @@ ...@@ -12,12 +12,12 @@
// it under the terms of the GNU Lesser General Public License as published by // 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 // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// OpenFlipper is distributed in the hope that it will be useful, // OpenFlipper is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details. // GNU Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with OpenFlipper. If not, see <http://www.gnu.org/licenses/>. // along with OpenFlipper. If not, see <http://www.gnu.org/licenses/>.
// //
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
//============================================================================= //=============================================================================
/** /**
* \file Types.hh * \file Types.hh
* This File contains the basic available datatypes in the Framework. * This File contains the basic available datatypes in the Framework.
*/ */
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
#ifndef MESHOBJECT_HH #ifndef MESHOBJECT_HH
#define MESHOBJECT_HH #define MESHOBJECT_HH
#ifdef WIN32 #ifdef WIN32
#define DLLEXPORT __declspec(dllexport) #define DLLEXPORT __declspec(dllexport)
#else #else
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
#include <ACG/Scenegraph/ShaderNode.hh> #include <ACG/Scenegraph/ShaderNode.hh>
#include <ACG/Scenegraph/StatusNodesT.hh> #include <ACG/Scenegraph/StatusNodesT.hh>
/// Additional Node status Bits for Mesh /// Additional Node status Bits for Mesh
enum StatusBits { enum StatusBits {
/// Modifyable area /// Modifyable area
AREA = OpenMesh::Attributes::UNUSED << 1, AREA = OpenMesh::Attributes::UNUSED << 1,
...@@ -75,148 +75,160 @@ enum StatusBits { ...@@ -75,148 +75,160 @@ enum StatusBits {
#include "StatusNodeMods.hh" #include "StatusNodeMods.hh"
#include "TriangleMeshTypes.hh" #include "TriangleMeshTypes.hh"
#include "PolyMeshTypes.hh" #include "PolyMeshTypes.hh"
// -------------------- BSP // -------------------- BSP
#include <OpenFlipper/common/bsp/TriangleBSPT.hh> #include <OpenFlipper/common/bsp/TriangleBSPT.hh>
#include "BaseObjectData.hh"
#include "BaseObjectData.hh"
//== TYPEDEFS ================================================================= //== TYPEDEFS =================================================================
/// Texture Node /// Texture Node
typedef ACG::SceneGraph::TextureNode TextureNode; typedef ACG::SceneGraph::TextureNode TextureNode;
//== CLASS DEFINITION ========================================================= //== CLASS DEFINITION =========================================================
/** This class provides the functionality for all kind of meshes for the framework /** This class provides the functionality for all kind of meshes for the framework
*/ */
template < class MeshT, DataType objectDataType > template < class MeshT, DataType objectDataType >
class DLLEXPORT MeshObject : public BaseObjectData { class DLLEXPORT MeshObject : public BaseObjectData {
public: public:
/// constructor /// constructor
MeshObject(SeparatorNode* _rootNode); MeshObject(SeparatorNode* _rootNode);
/// destructor /// destructor
virtual ~MeshObject(); virtual ~MeshObject();
/// Reset current object, including all related nodes. /// Reset current object, including all related nodes.
virtual void cleanup(); virtual void cleanup();
protected: protected:
/// Initialise current object, including all related nodes. /// Initialise current object, including all related nodes.
virtual void init(); virtual void init();
//=========================================================================== //===========================================================================
/** @name Name and Path handling /** @name Name and Path handling
* @{ */ * @{ */
//=========================================================================== //===========================================================================
public: public:
/// Set the name of the Object /// Set the name of the Object
void setName( QString _name ); void setName( QString _name );
//=========================================================================== //===========================================================================
/** @name Content /** @name Content
* @{ */ * @{ */
//=========================================================================== //===========================================================================
public: public:
/// return a pointer to the mesh /// return a pointer to the mesh
MeshT* mesh(); MeshT* mesh();
/// Update the whole Object (Selection,Topology,...) /// Update the whole Object (Selection,Topology,...)
virtual void update(); virtual void update();
/// Call this function to update the modeling regions /// Call this function to update the modeling regions
void updateSelection(); void updateSelection();
/// Call this function to update the modeling regions /// Call this function to update the modeling regions
void updateModelingRegions(); void updateModelingRegions();
/// Update Geometry of all data structures /// Update Geometry of all data structures
void updateGeometry(); void updateGeometry();
/// Update Topology of all data structures /// Update Topology of all data structures
void updateTopology(); void updateTopology();
private: private:
MeshT* mesh_; MeshT* mesh_;
/** @} */ /** @} */
//=========================================================================== //===========================================================================
/** @name Visualization /** @name Visualization
* @{ */ * @{ */
//=========================================================================== //===========================================================================
public: public:
/// Get the TextureNode of the current mesh /// Get the TextureNode of the current mesh
TextureNode* textureNode(); TextureNode* textureNode();
/// Return pointer to the shader node /// Return pointer to the shader node
ACG::SceneGraph::ShaderNode* shaderNode(); ACG::SceneGraph::ShaderNode* shaderNode();
/// Hide or show the selection Node of the object
void hideSelection( bool _hide );
/// return if the selections are currently visible
bool selectionVisible();
/// Hide or show the area Nodes of the object
void hideAreaNodes( bool _hide );
/// return if the areas are currently visible
bool areasVisible();
/// Get the Scenegraph Mesh Node /// Get the Scenegraph Mesh Node
ACG::SceneGraph::MeshNodeT<MeshT>* meshNode();; ACG::SceneGraph::MeshNodeT<MeshT>* meshNode();;
/// Get the BoundingBox of this object /// Get the BoundingBox of this object
void boundingBox( ACG::Vec3f& _bbMin , typename ACG::Vec3f& _bbMax ); void boundingBox( ACG::Vec3f& _bbMin , typename ACG::Vec3f& _bbMax );
private : private :
/// Status Node for a mesh, visualizing the selection state of a mesh /// Status Node for a mesh, visualizing the selection state of a mesh
ACG::SceneGraph::SelectionNodeT<MeshT>* statusNode_; ACG::SceneGraph::SelectionNodeT<MeshT>* statusNode_;
/// Area selection Vis /// Area selection Vis
ACG::SceneGraph::StatusNodeT<MeshT, AreaNodeMod<MeshT> > * areaNode_; ACG::SceneGraph::StatusNodeT<MeshT, AreaNodeMod<MeshT> > * areaNode_;
/// Handle selection Vis /// Handle selection Vis
ACG::SceneGraph::StatusNodeT<MeshT, HandleNodeMod<MeshT> > * handleNode_; ACG::SceneGraph::StatusNodeT<MeshT, HandleNodeMod<MeshT> > * handleNode_;
/// Scenegraph Mesh Node /// Scenegraph Mesh Node
ACG::SceneGraph::MeshNodeT<MeshT>* meshNode_; ACG::SceneGraph::MeshNodeT<MeshT>* meshNode_;
/// Scenegraph TextureNode /// Scenegraph TextureNode
TextureNode* textureNode_; TextureNode* textureNode_;
/// Scenegraph ShaderNode /// Scenegraph ShaderNode
ACG::SceneGraph::ShaderNode* shaderNode_; ACG::SceneGraph::ShaderNode* shaderNode_;
/** @} */ /** @} */
//=========================================================================== //===========================================================================
/** @name Load/Save /** @name Load/Save
* @{ */ * @{ */
//=========================================================================== //===========================================================================
public: public:
/// Load a mesh from the given file /// Load a mesh from the given file
bool loadMesh(QString _filename); bool loadMesh(QString _filename);
/** @} */ /** @} */
//=========================================================================== //===========================================================================
/** @name Object Information /** @name Object Information
* @{ */ * @{ */
//=========================================================================== //===========================================================================
public: public:
/// Get all Info for the Object as a string /// Get all Info for the Object as a string
QString getObjectinfo(); QString getObjectinfo();
/** @} */ /** @} */
//=========================================================================== //===========================================================================
/** @name Picking /** @name Picking
* @{ */ * @{ */
//=========================================================================== //===========================================================================
public: public:
/// detect if the node has been picked /// detect if the node has been picked
bool picked( uint _node_idx ); bool picked( uint _node_idx );
...@@ -226,17 +238,17 @@ class DLLEXPORT MeshObject : public BaseObjectData { ...@@ -226,17 +238,17 @@ class DLLEXPORT MeshObject : public BaseObjectData {
/// Check if picking is enabled for this Node /// Check if picking is enabled for this Node
bool pickingEnabled(); bool pickingEnabled();
/** @} */ /** @} */
//=========================================================================== //===========================================================================
/** @name Texture Handling /** @name Texture Handling
* @{ */ * @{ */
//=========================================================================== //===========================================================================
public : public :
void addTexture(QString _property, QString _textureFile ); void addTexture(QString _property, QString _textureFile );
/** This vector is used to store the available Textures, which will be handled /** This vector is used to store the available Textures, which will be handled
* by the texture control plugin. For meshes the first String identifies the mesh * by the texture control plugin. For meshes the first String identifies the mesh
* property used for the texture coordinates. The second String identifies the * property used for the texture coordinates. The second String identifies the
...@@ -244,36 +256,36 @@ class DLLEXPORT MeshObject : public BaseObjectData { ...@@ -244,36 +256,36 @@ class DLLEXPORT MeshObject : public BaseObjectData {
* nothing happens if you select it. * nothing happens if you select it.
*/ */
std::vector< std::pair < QString , QString > > textures; std::vector< std::pair < QString , QString > > textures;
/** @} */ /** @} */
//=========================================================================== //===========================================================================
/** @name BSP Extension ( Implements a BSP for the mesh used for fast searches ) /** @name BSP Extension ( Implements a BSP for the mesh used for fast searches )
* @{ */ * @{ */
//=========================================================================== //===========================================================================
public: public:
typedef OpenMeshTriangleBSPT< MeshT > OMTriangleBSP; typedef OpenMeshTriangleBSPT< MeshT > OMTriangleBSP;
/** Get a bsp for this object. Only supported for Triangle Meshes at the moment. /** Get a bsp for this object. Only supported for Triangle Meshes at the moment.
* *
* *
* @return Pointer to bsp or Null if unsupported for this type. * @return Pointer to bsp or Null if unsupported for this type.
*/ */
OMTriangleBSP* requestTriangleBsp(); OMTriangleBSP* requestTriangleBsp();
/** If something in the mesh changes, call this function to clear the octree. /** If something in the mesh changes, call this function to clear the octree.
* You have to do a new request as the old one will be deleted. * You have to do a new request as the old one will be deleted.
* @todo : Update the tree when the update function of this object is called. * @todo : Update the tree when the update function of this object is called.
* @todo : dont recreate but update the old one. * @todo : dont recreate but update the old one.
* @return The new pointer to the bsp or Null if unsupported * @return The new pointer to the bsp or Null if unsupported
*/ */
OMTriangleBSP* resetTriangleBsp(); OMTriangleBSP* resetTriangleBsp();
private : private :
/// If requested a bsp is created for this object /// If requested a bsp is created for this object
OMTriangleBSP* triangle_bsp_; OMTriangleBSP* triangle_bsp_;
/** @} */ /** @} */
}; };
//============================================================================= //=============================================================================
...@@ -282,8 +294,8 @@ class DLLEXPORT MeshObject : public BaseObjectData { ...@@ -282,8 +294,8 @@ class DLLEXPORT MeshObject : public BaseObjectData {
#define TYPES_TEMPLATES #define TYPES_TEMPLATES
#include "MeshObjectT.cc" #include "MeshObjectT.cc"
#endif #endif
//============================================================================= //=============================================================================
#endif // MESHOBJECT_HH defined #endif // MESHOBJECT_HH defined
//============================================================================= //=============================================================================
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