Developer Documentation
MeshObjectT.cc
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openflipper.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenFlipper. *
11  *---------------------------------------------------------------------------*
12  * *
13  * Redistribution and use in source and binary forms, with or without *
14  * modification, are permitted provided that the following conditions *
15  * are met: *
16  * *
17  * 1. Redistributions of source code must retain the above copyright notice, *
18  * this list of conditions and the following disclaimer. *
19  * *
20  * 2. Redistributions in binary form must reproduce the above copyright *
21  * notice, this list of conditions and the following disclaimer in the *
22  * documentation and/or other materials provided with the distribution. *
23  * *
24  * 3. Neither the name of the copyright holder nor the names of its *
25  * contributors may be used to endorse or promote products derived from *
26  * this software without specific prior written permission. *
27  * *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 \*===========================================================================*/
41 
42 /*===========================================================================*\
43 * *
44 * $Revision$ *
45 * $LastChangedBy$ *
46 * $Date$ *
47 * *
48 \*===========================================================================*/
49 
50 
51 
52 
53  //=============================================================================
54  //
55  // MyTypes
56  //
57  //=============================================================================
58 
59  #define MESHOBJECT_C
60 
61 
62  //== INCLUDES =================================================================
63 
65  #include <ACG/Scenegraph/DrawModes.hh>
68 
69 
70  //== TYPEDEFS =================================================================
71 
72  //== CLASS DEFINITION =========================================================
73 
74  template < class MeshT >
76  BaseObjectData(_object),
77  statusNode_(0),
78  areaNode_(0),
79  handleNode_(0),
80  featureNode_(0),
81  meshNode_(0),
82  textureNode_(0),
83  shaderNode_(0),
84  statusView_(0),
85  triangle_bsp_(0)
86  {
87  init(_object.mesh_);
88 
89 
90  setName( name() );
91 
92 // textures_ = _object.textures_;
93 // textureNames_ = _object.textureNames_;
94  }
95 
103  template < class MeshT >
105  BaseObjectData(),
106  mesh_(0),
107  statusNode_(0),
108  areaNode_(0),
109  handleNode_(0),
110  featureNode_(0),
111  meshNode_(0),
112  textureNode_(0),
113  shaderNode_(0),
114  statusView_(0),
115  triangle_bsp_(0)
116  {
117  setDataType(_typeId);
118  init();
119  }
120 
124  template < class MeshT >
126  {
127  // Delete the data attached to this object ( this will remove all perObject data)
128  // Not the best way to do it but it will work.
129  // This is only necessary if people use references to the mesh below and
130  // they do something with the mesh in the destructor of their
131  // perObjectData.
132  deleteData();
133 
134  // Delete the Mesh only, if this object contains a mesh
135  if ( mesh_ != NULL) {
136  delete mesh_;
137  mesh_ = NULL;
138  } else {
139  std::cerr << "Destructor error : Mesh already deleted" << std::endl;
140  }
141 
142  if ( triangle_bsp_ != 0 )
143  delete triangle_bsp_;
144  triangle_bsp_ = 0;
145 
146  // No need to delete the scenegraph Nodes as this will be managed by baseplugin
147  areaNode_ = 0;
148  handleNode_ = 0;
149  featureNode_ = 0;
150  meshNode_ = 0;
151  textureNode_ = 0;
152  shaderNode_ = 0;
153  statusView_ = 0;
154  }
155 
159  template < class MeshT >
161  // Delete the Mesh only, if this object contains a mesh
162  if ( mesh_ != NULL) {
163  delete mesh_;
164  mesh_ = NULL;
165  } else {
166  std::cerr << "Cleanup error : Triangle Mesh already deleted" << std::endl;
167  }
168 
169  if ( triangle_bsp_ != 0 )
170  delete triangle_bsp_;
171  triangle_bsp_ = 0;
172 
174 
175  statusNode_ = 0;
176  areaNode_ = 0;
177  handleNode_ = 0;
178  featureNode_ = 0;
179  textureNode_ = 0;
180  shaderNode_ = 0;
181  meshNode_ = 0;
182  statusView_ = 0;
183 
184  init();
185 
186  }
187 
191  template < class MeshT >
192  void MeshObject< MeshT >::init(MeshT* _mesh) {
193 
194  if ( _mesh == 0 )
195  mesh_ = new MeshT();
196  else
197  mesh_ = new MeshT(*_mesh);
198 
199  // Prepare mesh and request required properties
200  mesh_->request_vertex_normals();
201  mesh_->request_face_normals();
202  mesh_->request_vertex_status();
203  mesh_->request_halfedge_status();
204  mesh_->request_face_status();
205  mesh_->request_edge_status();
206  mesh_->request_vertex_colors();
207  mesh_->request_face_colors();
208 
209  // Only initialize scenegraph nodes when we initialized a gui!!
210  if ( OpenFlipper::Options::nogui() )
211  return;
212 
213  // This should never happen!
214  if ( manipulatorNode() == NULL)
215  std::cerr << "Error when creating Mesh Object! manipulatorNode is NULL!" << std::endl;
216 
217 
218  textureNode_ = new ACG::SceneGraph::EnvMapNode(materialNode(),"NEW TextureNode for ", true, GL_LINEAR_MIPMAP_LINEAR );
219 
220  shaderNode_ = new ACG::SceneGraph::ShaderNode(textureNode() , "NEW ShaderNode for ");
221 
223 
224  QString shaderDir = OpenFlipper::Options::shaderDirStr() + OpenFlipper::Options::dirSeparator();
225 
226  std::string shaderDirectory = std::string( shaderDir.toUtf8() );
227  shaderNode_->setShaderDir( shaderDirectory );
228 
229 
230  if ( QFile( shaderDir + "Phong/Vertex.glsl").exists() && QFile( shaderDir + "Phong/Fragment.glsl" ).exists() )
231  shaderNode_->setShader(ACG::SceneGraph::DrawModes::SOLID_PHONG_SHADED,"Phong/Vertex.glsl" , "Phong/Fragment.glsl" );
232  else
233  std::cerr << "Shader Files for Phong not found!" << std::endl;
234 
235 
236  // Node showing selection
237  statusNode_ = new ACG::SceneGraph::SelectionNodeT<MeshT>(*mesh_, 0, "NEW StatusNode for mesh " );
238  statusNode_->set_point_size(4.0);
239  statusNode_->set_color(ACG::Vec4f(1.0f,0.0f,0.0f,1.0f));
240  statusNode_->set_base_color(ACG::Vec4f(1.0f,0.0f,0.0f,1.0f));
241  // Status nodes are handled specially by their StatusViewNodeT parent which
242  // is why they get a NONE draw mode.
244 
245  // Node showing modeling region
246  areaNode_ = new ACG::SceneGraph::StatusNodeT<MeshT, AreaNodeMod<MeshT> >(*mesh_, 0, "NEW AreaNode for mesh ");
247  areaNode_->set_round_points(true);
248  areaNode_->enable_alpha_test(0.5);
249  areaNode_->set_point_size(7.0);
250  areaNode_->set_color(ACG::Vec4f(0.4f, 0.4f, 1.0f, 1.0f));
251  // Status nodes are handled specially by their StatusViewNodeT parent which
252  // is why they get a NONE draw mode.
254 
255  // Node showing handle region
256  handleNode_ = new ACG::SceneGraph::StatusNodeT<MeshT, HandleNodeMod<MeshT> >(*mesh_, 0, "NEW HandleNode for mesh ");
257  handleNode_->set_round_points(true);
258  handleNode_->enable_alpha_test(0.5);
259  handleNode_->set_line_width(2.0);
260  handleNode_->set_point_size(7.0);
261  handleNode_->set_color(ACG::Vec4f(0.2f, 1.0f, 0.2f, 1.0f));
262  // Status nodes are handled specially by their StatusViewNodeT parent which
263  // is why they get a NONE draw mode.
265 
266  // Node showing feature selection
267  featureNode_ = new ACG::SceneGraph::StatusNodeT<MeshT, FeatureNodeMod<MeshT> >(*mesh_, 0, "NEW FeatureNode for mesh ");
268  featureNode_->set_round_points(true);
269  featureNode_->enable_alpha_test(0.5);
270  featureNode_->set_line_width(2.0);
271  featureNode_->set_point_size(7.0);
272  featureNode_->set_color(ACG::Vec4f(1.0f, 0.2f, 1.0f, 1.0f));
273  featureNode_->set_base_color(ACG::Vec4f(1.0f, 0.2f, 1.0f, 1.0f));
274  // Status nodes are handled specially by their StatusViewNodeT parent which
275  // is why they get a NONE draw mode.
277 
278  // Link the status nodes to the draw mesh of the mesh below them to reuse its buffers
279  if (meshNode_) {
284  }
285 
286  // Node rendering selections in correct order
287  statusView_ = new ACG::SceneGraph::StatusViewNodeT<MeshT>(manipulatorNode(), "NEW StatusViewNode for mesh ",
288  statusNode_,
289  areaNode_,
290  handleNode_,
291  featureNode_);
292 
293  // make StatusViewNode parent of status nodes
294  statusNode_->set_parent(statusView_);
295  areaNode_->set_parent(statusView_);
296  handleNode_->set_parent(statusView_);
297  featureNode_->set_parent(statusView_);
298 
299  // Update all nodes
300  update();
301  }
302 
303  // ===============================================================================
304  // Name/Path Handling
305  // ===============================================================================
306 
310  template < class MeshT >
311  void MeshObject< MeshT >::setName( QString _name ) {
313 
314  // No update when gui is not active
315  if ( OpenFlipper::Options::nogui() )
316  return;
317 
318  std::string nodename = std::string("StatusNode for mesh " + _name.toUtf8() );
319  statusNode_->name( nodename );
320 
321  nodename = std::string("AreaNode for mesh " + _name.toUtf8() );
322  areaNode_->name( nodename );
323 
324  nodename = std::string("HandleNode for mesh " + _name.toUtf8() );
325  handleNode_->name( nodename );
326 
327  nodename = std::string("FeatureNode for mesh " + _name.toUtf8() );
328  featureNode_->name( nodename );
329 
330  nodename = std::string("TextureNode for mesh "+ _name.toUtf8() );
331  textureNode_->name( nodename );
332 
333  nodename = std::string("ShaderNode for mesh "+ _name.toUtf8() );
334  shaderNode_->name( nodename );
335 
336  nodename = std::string("MeshNode for mesh " + _name.toUtf8() );
337  meshNode_->name( nodename );
338 
339  nodename = std::string("StatusViewNode for mesh " + _name.toUtf8() );
340  statusView_->name( nodename );
341  }
342 
343  // ===============================================================================
344  // Content
345  // ===============================================================================
346 
350  template < class MeshT >
352  return mesh_;
353  }
354 
359  template < class MeshT >
361 
362  // No update necessary if no gui
363  if ( OpenFlipper::Options::nogui() )
364  return;
365 
367 
368  if ( _type.contains(UPDATE_ALL) || _type.contains(UPDATE_TOPOLOGY) ){
369  updateGeometry();
370  updateColor();
371  updateTopology();
372  updateSelection();
373  updateFeatures();
375  updateTexture();
376  }
377  else
378  {
379  if ( _type.contains(UPDATE_GEOMETRY) ) {
380  updateGeometry();
381  }
382  if ( _type.contains(UPDATE_SELECTION) ) {
383  updateSelection();
384  updateFeatures();
386  }
387  if ( _type.contains(UPDATE_COLOR) ) {
388  updateColor();
389  }
390  if ( _type.contains(UPDATE_TEXTURE)) {
391  updateTexture();
392  }
393  }
394  }
395 
397  template < class MeshT >
399 
400  if ( statusNode_ ){
402  }
403  }
404 
406  template < class MeshT >
408 
409  if ( meshNode_ ) {
411 
412  // Also update the selection nodes here.
413  // These nodes store their positions based on the mesh.
414  // So they would be at the wrong position afterwards
419 
420  }
421 
423  }
424 
426  template < class MeshT >
428  if ( meshNode_ )
430  }
431 
433  template < class MeshT >
435  if ( meshNode_ ) {
441  }
443  }
444 
446  template < class MeshT >
448  if ( areaNode_ && handleNode_ ) {
451  }
452  }
453 
455  template < class MeshT >
457  if ( featureNode_ )
459  }
460 
462  template < class MeshT >
465  }
466 
467 
468  // ===============================================================================
469  // Visualization
470  // ===============================================================================
471  template < class MeshT >
473  {
474  if (statusNode_)
475  {
476  statusNode_->set_color(_color);
477  statusNode_->set_base_color(_color);
478  }
479  }
480 
481  template < class MeshT >
483  {
484  if (statusNode_)
485  return statusNode_->base_color();
486  else
487  return ACG::Vec4f(-1.f,-1.f,-1.f,-1.f);
488  }
489 
490  template < class MeshT >
492  {
493  if (areaNode_)
494  {
495  areaNode_->set_color(_color);
496  areaNode_->set_base_color(_color);
497  }
498  }
499  template < class MeshT >
501  {
502  if (areaNode_)
503  return areaNode_->base_color();
504  else
505  return ACG::Vec4f(-1.f,-1.f,-1.f,-1.f);
506  }
507 
508  template < class MeshT >
510  {
511  if (featureNode_)
512  {
513  featureNode_->set_color(_color);
514  featureNode_->set_base_color(_color);
515  }
516  }
517  template < class MeshT >
519  {
520  if (featureNode_)
521  return featureNode_->base_color();
522  else
523  return ACG::Vec4f(-1.f,-1.f,-1.f,-1.f);
524  }
525 
526  template < class MeshT >
528  {
529  if (handleNode_)
530  {
531  handleNode_->set_color(_color);
532  handleNode_->set_base_color(_color);
533  }
534  }
535  template < class MeshT >
537  {
538  if (handleNode_)
539  return handleNode_->base_color();
540  else
541  return ACG::Vec4f(-1.f,-1.f,-1.f,-1.f);
542  }
543 
544 
548  template < class MeshT >
550  return textureNode_;
551  }
552 
556  template < class MeshT >
558  return shaderNode_;
559  }
560 
563  template < class MeshT >
565 
566  if ( _hide ) {
568  } else {
570  }
571 
572  }
573 
574  template < class MeshT >
576  if ( _hide ) {
578  } else {
580  }
581  }
582 
583  template < class MeshT >
585  return ( featureNode_->status() == ACG::SceneGraph::BaseNode::Active );
586  }
587 
590  template < class MeshT >
591  void MeshObject< MeshT >::hideArea( StatusBits _bit, bool _hide ) {
593 
594  if ( _hide ) {
596  }else
598 
599  if ( _bit & AREA ) {
600  areaNode_->set_status( status );
601  }
602 
603  if ( _bit & HANDLEAREA )
604  handleNode_->set_status( status );
605 
606  }
607 
608  template < class MeshT >
610  return ( statusNode_->status() == ACG::SceneGraph::BaseNode::Active );
611  }
612 
613  template < class MeshT >
614  bool MeshObject< MeshT >::areaVisible( StatusBits _bit ) {
615  bool status = true;
616 
617  if ( _bit & AREA )
618  status &= ( areaNode_->status() == ACG::SceneGraph::BaseNode::Active );
619 
620  if ( _bit & HANDLEAREA )
621  status &= ( handleNode_->status() == ACG::SceneGraph::BaseNode::Active );
622 
623  return status;
624  }
625 
629  template < class MeshT >
631  return meshNode_;
632  }
633 
636  template < class MeshT >
638  if ( meshNode_ ) {
639  _bbMin = ACG::Vec3d(FLT_MAX, FLT_MAX, FLT_MAX);
640  _bbMax = ACG::Vec3d(-FLT_MAX, -FLT_MAX, -FLT_MAX);
641  meshNode_->boundingBox(_bbMin,_bbMax);
642  } else {
643  std::cerr << "Error: Bounding box computation via Scenegraph not available without gui" << std::endl;
644  }
645  }
646 
647  // ===============================================================================
648  // Load/Save
649  // ===============================================================================
650 
656  template < class MeshT >
657  bool MeshObject< MeshT >::loadMesh(QString _filename) {
658 
659  setFromFileName(_filename);
660 
661  // call the local function to update names
662  setName( name() );
663 
664  std::string filename = std::string( _filename.toUtf8() );
665 
666  // load file
667  bool ok = OpenMesh::IO::read_mesh( (*mesh()) , filename );
668  if (!ok)
669  {
670  if ( dataType() == typeid("TriangleMesh") )
671  std::cerr << "Main Application : Read error for Triangle Mesh at "<< filename << std::endl;
672  if ( dataType() == typeid("PolyMesh") )
673  std::cerr << "Main Application : Read error for Poly Mesh\n";
674  return false;
675  }
676 
677  mesh()->update_normals();
678 
679  update();
680 
681  show();
682 
683  return true;
684  }
685 
686  // ===============================================================================
687  // Object information
688  // ===============================================================================
689 
695  template < class MeshT >
697  QString output;
698 
699  output += "========================================================================\n";
700  output += BaseObjectData::getObjectinfo();
701 
702  if ( dataType( typeId("TriangleMesh") ) )
703  output += "Object Contains Triangle Mesh : ";
704 
705  if ( dataType( typeId("PolyMesh") ) )
706  output += "Object Contains Poly Mesh : ";
707 
708  output += QString::number( mesh()->n_vertices() ) + " vertices, ";
709  output += QString::number( mesh()->n_edges() ) += " edges ";
710  output += QString::number( mesh()->n_faces() ) += " faces.\n";
711 
712  output += "========================================================================\n";
713  return output;
714  }
715 
716  // ===============================================================================
717  // Picking
718  // ===============================================================================
719 
726  template < class MeshT >
727  bool MeshObject< MeshT >::picked( uint _node_idx ) {
728  return ( _node_idx == meshNode_->id() );
729  }
730 
731 
732  template < class MeshT >
733  void MeshObject< MeshT >::enablePicking( bool _enable ) {
734  if ( OpenFlipper::Options::nogui())
735  return;
736 
737  meshNode_->enablePicking( _enable );
738  areaNode_->enablePicking( _enable );
739  handleNode_->enablePicking( _enable );
740  featureNode_->enablePicking( _enable );
741  textureNode_->enablePicking( _enable );
742  shaderNode_->enablePicking( _enable );
743  }
744 
745  template < class MeshT >
747  return meshNode_->pickingEnabled();
748  }
749 
750  // ===============================================================================
751  // Octree
752  // ===============================================================================
753 
754  template < class MeshT >
757 
758  if ( ! dataType( typeId("TriangleMesh") ) ) {
759  std::cerr << "Bsps are only supported for triangle meshes." << std::endl;
760  return 0;
761  }
762 
763  // Create the tree if needed.
764  if ( triangle_bsp_ == 0 )
765  {
766  // create Triangle BSP
767  triangle_bsp_ = new OMTriangleBSP( *mesh() );
768 
769  // build Triangle BSP
770  triangle_bsp_->reserve(mesh()->n_faces());
771 
772  typename MeshT::FIter f_it = mesh()->faces_begin();
773  typename MeshT::FIter f_end = mesh()->faces_end();
774 
775  for (; f_it!=f_end; ++f_it)
776  triangle_bsp_->push_back(*f_it);
777 
778  triangle_bsp_->build(10, 100); //max vertices per leaf 10, max depth 100
779  }
780 
781  // return pointer to triangle bsp
782  return triangle_bsp_;
783  }
784 
785  template < class MeshT >
788  if ( triangle_bsp_ != 0 )
789  {
790  delete triangle_bsp_;
791  triangle_bsp_ = 0;
792  }
793 
794  return requestTriangleBsp();
795  }
796 
797  template < class MeshT >
798  void
800  if ( triangle_bsp_ != 0 )
801  {
802  delete triangle_bsp_;
803  triangle_bsp_ = 0;
804  }
805  }
806 
807 
808  template < class MeshT >
809  bool
811  return triangle_bsp_ != 0;
812  }
813 
814 
815  //=============================================================================
816 
817  template < class MeshT >
818  BaseNode*
820  return boundingBoxNode();
821  }
822 
823  //=============================================================================
824 
void setMainGLContext()
Set current GL Context to main context.
void setDrawMesh(DrawMeshT< Mesh > *_drawmesh)
Set drawmesh.
void reserve(size_t _n)
Reserve memory for _n entries.
Predefined datatypes.
Definition: DataTypes.hh:96
DLLEXPORT DataType typeId(QString _name)
Given a dataType Identifier string this function will return the id of the datatype.
Definition: Types.cc:150
void setDataType(DataType _type)
Definition: BaseObject.cc:244
void update_geometry()
the geometry of the mesh has changed
MeshT * mesh_
pointer to the mesh
Definition: MeshObjectT.hh:157
const UpdateType UPDATE_TEXTURE(UpdateTypeSet(1)<< 11)
Textures have changed.
VectorT< float, 4 > Vec4f
Definition: VectorT.hh:144
ACG::Vec4f selectionColor() const
get color for selection. returns -1 vector, if handle node does not exists
Definition: MeshObjectT.cc:482
virtual void cleanup()
const UpdateType UPDATE_TOPOLOGY(UpdateTypeSet(1)<< 3)
Topology updated.
ACG::SceneGraph::StatusNodeT< MeshT, HandleNodeMod< MeshT > > * handleNode_
Handle selection Vis.
Definition: MeshObjectT.hh:290
virtual void init(MeshT *_mesh=0)
Initialise current object, including all related nodes.
Definition: MeshObjectT.cc:192
QString filename() const
return the filename of the object
Definition: BaseObject.cc:717
void update_topology()
the topology of the mesh has changed
Draw node & children.
Definition: BaseNode.hh:423
void enablePicking(bool _enable)
Enable or disable picking for this Node.
Definition: MeshObjectT.cc:733
ACG::SceneGraph::ShaderNode ShaderNode
Simple Name for ShaderNode.
ACG::SceneGraph::MeshNodeT< MeshT > * meshNode_
Scenegraph Mesh Node.
Definition: MeshObjectT.hh:296
ACG::SceneGraph::StatusNodeT< MeshT, AreaNodeMod< MeshT > > * areaNode_
Area selection Vis.
Definition: MeshObjectT.hh:287
BoundingBoxNode * boundingBoxNode()
get a pointer to the bounding box node
void boundingBox(Vec3d &_bbMin, Vec3d &_bbMax)
Current bounding box.
bool selectionVisible()
return if the selections are currently visible
Definition: MeshObjectT.cc:609
void update_color()
the colors of the mesh have changed
void setHandleColor(const ACG::Vec4f &_color)
set color for handles
Definition: MeshObjectT.cc:527
virtual void show()
Sets the whole Scenegraph subtree of this node to visible.
bool featuresVisible()
return if the feature Node of the object is currently visible
Definition: MeshObjectT.cc:584
void hideArea(StatusBits _bit, bool _hide)
Hide or show the area Nodes of the object.
Definition: MeshObjectT.cc:591
void updateTexture()
Update Texture of all data structures.
Definition: MeshObjectT.cc:463
void push_back(Handle _h)
Add a handle to the BSP.
QtTranslationManipulatorNode * manipulatorNode()
void setFromFileName(const QString &_filename)
Definition: BaseObject.cc:727
bool areaVisible(StatusBits _bit)
Return if the selected areas are currently visible.
Definition: MeshObjectT.cc:614
MeshT * mesh()
return a pointer to the mesh
Definition: MeshObjectT.cc:351
BaseNode * primaryNode()
Status Node for a mesh, visualizing the selection state of a mesh.
Definition: MeshObjectT.cc:819
void set_parent(BaseNode *_parent)
Set the parent of this node.
Definition: BaseNode.cc:152
Update type class.
Definition: UpdateType.hh:70
ACG::Vec4f handleColor() const
get color for handles. returns -1 vector, if handle node does not exists
Definition: MeshObjectT.cc:536
MaterialNode * materialNode()
get a pointer to the materialnode
MeshObject(const MeshObject &_object)
copy constructor
Definition: MeshObjectT.cc:75
ACG::SceneGraph::SelectionNodeT< MeshT > * statusNode_
Status Node for a mesh, visualizing the selection state of a mesh.
Definition: MeshObjectT.hh:284
const UpdateType UPDATE_COLOR(UpdateTypeSet(1)<< 10)
Colors have changed.
ACG::SceneGraph::ShaderNode * shaderNode()
Return pointer to the shader node.
Definition: MeshObjectT.cc:557
void setName(QString _name)
Set the name of the Object.
Definition: MeshObjectT.cc:311
void updateFeatures()
Update Feature Visualization Node.
Definition: MeshObjectT.cc:456
bool contains(const UpdateType &_type) const
Check if this update contains the given UpdateType.
Definition: UpdateType.cc:111
DrawMode SOLID_PHONG_SHADED
draw phong shaded faces
Definition: DrawModes.cc:89
virtual void setName(QString _name)
path to the file from which the object is loaded ( defaults to "." )
OMTriangleBSP * resetTriangleBsp()
Definition: MeshObjectT.cc:787
bool read_mesh(Mesh &_mesh, const std::string &_filename)
Read a mesh from file _filename.
Definition: MeshIO.hh:104
void updateTopology()
set topology invalid (updates everything)
void setFeatureColor(const ACG::Vec4f &_color)
set color for features
Definition: MeshObjectT.cc:509
ACG::SceneGraph::EnvMapNode * textureNode()
Get the TextureNode of the current mesh.
Definition: MeshObjectT.cc:549
void updateGeometry()
set geometry invalid, topology and selection is kept
void deleteData()
Delete all data attached to this object ( calls delete on each object )
Definition: BaseObject.cc:823
Hide this node, but draw children.
Definition: BaseNode.hh:425
const UpdateType UPDATE_GEOMETRY(UpdateTypeSet(1)<< 2)
Geometry updated.
StatusMode
Status modi.
Definition: BaseNode.hh:420
void boundingBox(ACG::Vec3d &_bbMin, typename ACG::Vec3d &_bbMax)
Get the BoundingBox of this object.
Definition: MeshObjectT.cc:637
void hideSelection(bool _hide)
Hide or show the selection Node of the object.
Definition: MeshObjectT.cc:564
OMTriangleBSP * requestTriangleBsp()
Definition: MeshObjectT.cc:756
bool pickingEnabled()
Check if picking is enabled for this Node.
Definition: MeshObjectT.cc:746
void updateModelingRegions()
Call this function to update the modeling regions.
Definition: MeshObjectT.cc:447
bool hasBsp() const
check if a BSP has been computed and is valid
Definition: MeshObjectT.cc:810
void invalidateTriangleBsp()
Definition: MeshObjectT.cc:799
std::string name() const
Returns: name of node (needs not be unique)
Definition: MeshNode2T.cc:446
void updateGeometry()
Update Geometry of all data structures.
Definition: MeshObjectT.cc:407
void update_textures()
force an texture update
bool picked(uint _node_idx)
detect if the node has been picked
Definition: MeshObjectT.cc:727
OpenMeshTriangleBSPT< MeshT > OMTriangleBSP
If requested a bsp is created for this object.
Definition: MeshObjectT.hh:354
ACG::Vec4f featureColor() const
get color for features. returns -1 vector, if handle node does not exists
Definition: MeshObjectT.cc:518
DrawMode NONE
not a valid draw mode
Definition: DrawModes.cc:77
ACG::SceneGraph::ShaderNode * shaderNode_
Scenegraph ShaderNode.
Definition: MeshObjectT.hh:302
virtual ~MeshObject()
destructor
Definition: MeshObjectT.cc:125
ACG::SceneGraph::StatusNodeT< MeshT, FeatureNodeMod< MeshT > > * featureNode_
Feature selection Vis.
Definition: MeshObjectT.hh:293
QString name() const
return the name of the object. The name defaults to NONAME if unset.
Definition: BaseObject.cc:741
const UpdateType UPDATE_SELECTION(UpdateTypeSet(1)<< 4)
Selection updated.
bool loadMesh(QString _filename)
Load a mesh from the given file.
Definition: MeshObjectT.cc:657
virtual QString getObjectinfo()
Get all Info for the Object as a string.
Definition: BaseObject.cc:255
void updateColor()
Update Colors of all data structures.
Definition: MeshObjectT.cc:427
ACG::SceneGraph::MeshNodeT< MeshT > * meshNode()
Get the Scenegraph Mesh Node.
Definition: MeshObjectT.cc:630
void build(unsigned int _max_handles, unsigned int _max_depth)
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
void updateSelection()
set selection invalid (Only selection changed, rest is kept)
DrawMeshT< Mesh > * getDrawMesh()
Get DrawMesh instance.
void hideFeatures(bool _hide)
Hide or show the feature Node of the object.
Definition: MeshObjectT.cc:575
QString getObjectinfo()
Get all Info for the Object as a string.
Definition: MeshObjectT.cc:696
virtual void update(UpdateType _type=UPDATE_ALL)
Update the whole Object (Selection,Topology,...)
Definition: MeshObjectT.cc:360
void setAreaColor(const ACG::Vec4f &_color)
set color for areas
Definition: MeshObjectT.cc:491
ACG::SceneGraph::StatusViewNodeT< MeshT > * statusView_
Scenegraph StatusNodeView.
Definition: MeshObjectT.hh:305
VectorT< double, 3 > Vec3d
Definition: VectorT.hh:127
void updateSelection()
Call this function to update the modeling regions.
Definition: MeshObjectT.cc:398
DataType dataType() const
Definition: BaseObject.cc:240
virtual void cleanup()
Reset current object, including all related nodes.
Definition: MeshObjectT.cc:160
ACG::SceneGraph::EnvMapNode * textureNode_
Scenegraph TextureNode.
Definition: MeshObjectT.hh:299
ACG::Vec4f areaColor() const
get color for areas. returns -1 vector, if handle node does not exists
Definition: MeshObjectT.cc:500
void updateTopology()
Update Topology of all data structures.
Definition: MeshObjectT.cc:434
OMTriangleBSP * triangle_bsp_
If requested a bsp is created for this object.
Definition: MeshObjectT.hh:392
void setSelectionColor(const ACG::Vec4f &_color)
set color for selection
Definition: MeshObjectT.cc:472