00001 /*===========================================================================*\ 00002 * * 00003 * OpenFlipper * 00004 * Copyright (C) 2001-2009 by Computer Graphics Group, RWTH Aachen * 00005 * www.openflipper.org * 00006 * * 00007 *---------------------------------------------------------------------------* 00008 * This file is part of OpenFlipper. * 00009 * * 00010 * OpenFlipper is free software: you can redistribute it and/or modify * 00011 * it under the terms of the GNU Lesser General Public License as * 00012 * published by the Free Software Foundation, either version 3 of * 00013 * the License, or (at your option) any later version with the * 00014 * following exceptions: * 00015 * * 00016 * If other files instantiate templates or use macros * 00017 * or inline functions from this file, or you compile this file and * 00018 * link it with other files to produce an executable, this file does * 00019 * not by itself cause the resulting executable to be covered by the * 00020 * GNU Lesser General Public License. This exception does not however * 00021 * invalidate any other reasons why the executable file might be * 00022 * covered by the GNU Lesser General Public License. * 00023 * * 00024 * OpenFlipper is distributed in the hope that it will be useful, * 00025 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00026 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00027 * GNU Lesser General Public License for more details. * 00028 * * 00029 * You should have received a copy of the GNU LesserGeneral Public * 00030 * License along with OpenFlipper. If not, * 00031 * see <http://www.gnu.org/licenses/>. * 00032 * * 00033 \*===========================================================================*/ 00034 00035 /*===========================================================================*\ 00036 * * 00037 * $Revision: 8727 $ * 00038 * $Author: wilden $ * 00039 * $Date: 2010-03-16 14:17:44 +0100 (Di, 16. Mär 2010) $ * 00040 * * 00041 \*===========================================================================*/ 00042 00043 00044 00045 00046 //============================================================================= 00047 // 00048 // Types 00049 // 00050 //============================================================================= 00051 00058 #ifndef MESHOBJECT_HH 00059 #define MESHOBJECT_HH 00060 00061 //== INCLUDES ================================================================= 00062 00063 // -------------------- OpenMesh 00064 #include <OpenMesh/Core/IO/MeshIO.hh> 00065 00066 #include <ACG/Scenegraph/SeparatorNode.hh> 00067 #include <ACG/Scenegraph/EnvMapNode.hh> 00068 #include <ACG/Scenegraph/ShaderNode.hh> 00069 #include <ACG/Scenegraph/StatusNodesT.hh> 00070 00071 #include <OpenFlipper/common/GlobalDefines.hh> 00072 00074 enum StatusBits { 00076 AREA = OpenMesh::Attributes::UNUSED << 1, 00078 HANDLEAREA = OpenMesh::Attributes::UNUSED << 2 00079 }; 00080 00081 #include <ObjectTypes/MeshObject/StatusNodeMods.hh> 00082 #include <OpenFlipper/common/BaseObjectData.hh> 00083 00084 // -------------------- BSP 00085 #include <OpenFlipper/common/bsp/TriangleBSPT.hh> 00086 00087 00088 #include <OpenFlipper/common/BaseObjectData.hh> 00089 #include <ACG/Scenegraph/MeshNode2T.hh> 00090 00091 00092 00093 00094 //== TYPEDEFS ================================================================= 00095 00097 typedef ACG::SceneGraph::TextureNode TextureNode; 00098 00099 //== CLASS DEFINITION ========================================================= 00100 00103 template < class MeshT > 00104 class DLLEXPORTONLY MeshObject : public BaseObjectData { 00105 public: 00106 00111 MeshObject(const MeshObject& _object); 00112 00120 MeshObject(DataType _typeId); 00121 00123 virtual ~MeshObject(); 00124 00126 virtual void cleanup(); 00127 00128 protected: 00129 00131 virtual void init( MeshT* _mesh = 0); 00132 00133 //=========================================================================== 00136 //=========================================================================== 00137 public: 00138 00140 void setName( QString _name ); 00141 00142 00143 //=========================================================================== 00146 //=========================================================================== 00147 00148 public: 00150 MeshT* mesh(); 00151 00153 virtual void update(UpdateType _type = UPDATE_ALL); 00154 00156 void updateSelection(); 00157 00159 void updateModelingRegions(); 00160 00162 void updateFeatures(); 00163 00165 void updateGeometry(); 00166 00168 void updateColor(); 00169 00171 void updateTopology(); 00172 00176 BaseObject* copy(); 00177 00178 private: 00179 MeshT* mesh_; 00180 00183 //=========================================================================== 00186 //=========================================================================== 00187 00188 public: 00189 00191 ACG::SceneGraph::EnvMapNode* textureNode(); 00192 00194 ACG::SceneGraph::ShaderNode* shaderNode(); 00195 00197 void hideSelection( bool _hide ); 00198 00200 bool selectionVisible(); 00201 00203 void hideFeatures( bool _hide ); 00204 00206 bool featuresVisible( ); 00207 00209 void hideAreas( bool _hide ); 00210 00212 bool areasVisible(); 00213 00215 ACG::SceneGraph::MeshNodeT<MeshT>* meshNode(); 00216 00218 void boundingBox( ACG::Vec3d& _bbMin , typename ACG::Vec3d& _bbMax ); 00219 00220 BaseNode* primaryNode(); 00221 00222 private : 00224 ACG::SceneGraph::SelectionNodeT<MeshT>* statusNode_; 00225 00227 ACG::SceneGraph::StatusNodeT<MeshT, AreaNodeMod<MeshT> > * areaNode_; 00228 00230 ACG::SceneGraph::StatusNodeT<MeshT, HandleNodeMod<MeshT> > * handleNode_; 00231 00233 ACG::SceneGraph::StatusNodeT<MeshT, FeatureNodeMod<MeshT> > *featureNode_; 00234 00236 ACG::SceneGraph::MeshNodeT<MeshT>* meshNode_; 00237 00239 ACG::SceneGraph::EnvMapNode* textureNode_; 00240 00242 ACG::SceneGraph::ShaderNode* shaderNode_; 00243 00246 //=========================================================================== 00249 //=========================================================================== 00250 00251 public: 00252 00254 bool loadMesh(QString _filename); 00255 00258 //=========================================================================== 00261 //=========================================================================== 00262 public: 00264 QString getObjectinfo(); 00265 00269 //=========================================================================== 00272 //=========================================================================== 00273 public: 00275 bool picked( uint _node_idx ); 00276 00278 void enablePicking( bool _enable ); 00279 00281 bool pickingEnabled(); 00282 00285 //=========================================================================== 00288 //=========================================================================== 00289 public: 00290 00291 typedef OpenMeshTriangleBSPT< MeshT > OMTriangleBSP; 00292 00298 OMTriangleBSP* requestTriangleBsp(); 00299 00306 void invalidateTriangleBsp(); 00307 00308 00314 OMTriangleBSP* resetTriangleBsp(); 00315 00316 00317 private : 00319 OMTriangleBSP* triangle_bsp_; 00320 00322 }; 00323 00324 //============================================================================= 00325 00326 #if defined(INCLUDE_TEMPLATES) && !defined(MESHOBJECT_C) 00327 #define MESHOBJECT_TEMPLATES 00328 #include "MeshObjectT.cc" 00329 #endif 00330 00331 00332 //============================================================================= 00333 #endif // MESHOBJECT_HH defined 00334 //=============================================================================