Developer Documentation
Loading...
Searching...
No Matches
MeshObjectT_impl.hh
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
45
46
47 //=============================================================================
48 //
49 // MyTypes
50 //
51 //=============================================================================
52
53 #define MESHOBJECT_C
54
55
56 //== INCLUDES =================================================================
57
59 #include <ACG/Scenegraph/DrawModes.hh>
62
63 #include <ACG/Scenegraph/ManipulatorNode.hh>
64 #include <ACG/Scenegraph/BoundingBoxNode.hh>
65 #include <ACG/QtScenegraph/QtTranslationManipulatorNode.hh>
66
67
68 //== TYPEDEFS =================================================================
69
70 //== CLASS DEFINITION =========================================================
71
72 template < class MeshT >
74 BaseObjectData(_object),
75 statusNode_(0),
76 areaNode_(0),
77 handleNode_(0),
78 featureNode_(0),
79 meshNode_(0),
80 textureNode_(0),
81 shaderNode_(0),
82 statusView_(0),
83 triangle_bsp_(0)
84 {
85 init(_object.mesh_);
86
87
88 setName( name() );
89
90// textures_ = _object.textures_;
91// textureNames_ = _object.textureNames_;
92 }
93
101 template < class MeshT >
104 mesh_(0),
105 statusNode_(0),
106 areaNode_(0),
107 handleNode_(0),
108 featureNode_(0),
109 meshNode_(0),
110 textureNode_(0),
111 shaderNode_(0),
112 statusView_(0),
113 triangle_bsp_(0)
114 {
115 setDataType(_typeId);
116 init();
118
122 template < class MeshT >
124 {
125 // Delete the data attached to this object ( this will remove all perObject data)
126 // Not the best way to do it but it will work.
127 // This is only necessary if people use references to the mesh below and
128 // they do something with the mesh in the destructor of their
129 // perObjectData.
130 deleteData();
131
132 // Delete the Mesh only, if this object contains a mesh
133 if ( mesh_ != NULL) {
134 delete mesh_;
135 mesh_ = NULL;
136 } else {
137 std::cerr << "Destructor error : Mesh already deleted" << std::endl;
138 }
139
140 if ( triangle_bsp_ != 0 )
141 delete triangle_bsp_;
142 triangle_bsp_ = 0;
143
144 // No need to delete the scenegraph Nodes as this will be managed by baseplugin
145 areaNode_ = 0;
146 handleNode_ = 0;
147 featureNode_ = 0;
148 meshNode_ = 0;
149 textureNode_ = 0;
150 shaderNode_ = 0;
151 statusView_ = 0;
152 }
153
157 template < class MeshT >
159 // Delete the Mesh only, if this object contains a mesh
160 if ( mesh_ != NULL) {
161 delete mesh_;
162 mesh_ = NULL;
163 } else {
164 std::cerr << "Cleanup error : Triangle Mesh already deleted" << std::endl;
165 }
166
167 if ( triangle_bsp_ != 0 )
168 delete triangle_bsp_;
169 triangle_bsp_ = 0;
170
172
173 statusNode_ = 0;
174 areaNode_ = 0;
175 handleNode_ = 0;
176 featureNode_ = 0;
177 textureNode_ = 0;
178 shaderNode_ = 0;
179 meshNode_ = 0;
180 statusView_ = 0;
181
182 init();
184 }
185
189 template < class MeshT >
191
192 if ( _mesh == 0 )
193 mesh_ = new MeshT();
194 else
195 mesh_ = new MeshT(*_mesh);
196
197 // Prepare mesh and request required properties
198 mesh_->request_vertex_normals();
199 mesh_->request_face_normals();
200 mesh_->request_vertex_status();
201 mesh_->request_halfedge_status();
202 mesh_->request_face_status();
203 mesh_->request_edge_status();
204 mesh_->request_vertex_colors();
205 mesh_->request_face_colors();
206
207 // Only initialize scenegraph nodes when we initialized a gui!!
208 if ( OpenFlipper::Options::nogui() )
209 return;
210
211 // This should never happen!
212 if ( manipulatorNode() == NULL)
213 std::cerr << "Error when creating Mesh Object! manipulatorNode is NULL!" << std::endl;
215
216 textureNode_ = new ACG::SceneGraph::EnvMapNode(materialNode(),"NEW TextureNode for ", true, GL_LINEAR_MIPMAP_LINEAR );
218 shaderNode_ = new ACG::SceneGraph::ShaderNode(textureNode() , "NEW ShaderNode for ");
219
220 meshNode_ = new ACG::SceneGraph::MeshNodeT<MeshT>(*mesh_, shaderNode_, "NEW MeshNode");
221
222 QString shaderDir = OpenFlipper::Options::shaderDirStr() + OpenFlipper::Options::dirSeparator();
224 std::string shaderDirectory = std::string( shaderDir.toUtf8() );
225 shaderNode_->setShaderDir( shaderDirectory );
226
227 if(!OpenFlipper::Options::coreProfile())
228 {
229 if ( QFile( shaderDir + "Phong/Vertex.glsl").exists() && QFile( shaderDir + "Phong/Fragment.glsl" ).exists() )
230 shaderNode_->setShader(ACG::SceneGraph::DrawModes::SOLID_PHONG_SHADED,"Phong/Vertex.glsl" , "Phong/Fragment.glsl" );
231 else
232 std::cerr << "Shader Files for Phong not found!" << std::endl;
234
235 // Node showing selection
236 statusNode_ = new ACG::SceneGraph::SelectionNodeT<MeshT>(*mesh_, 0, "NEW StatusNode for mesh " );
237 statusNode_->set_point_size(4.0);
238 statusNode_->set_color(ACG::Vec4f(1.0f,0.0f,0.0f,1.0f));
239 statusNode_->set_base_color(ACG::Vec4f(1.0f,0.0f,0.0f,1.0f));
240 // Status nodes are handled specially by their StatusViewNodeT parent which
241 // is why they get a NONE draw mode.
242 statusNode_->drawMode(ACG::SceneGraph::DrawModes::NONE);
243
244 // Node showing modeling region
245 areaNode_ = new ACG::SceneGraph::StatusNodeT<MeshT, AreaNodeMod<MeshT> >(*mesh_, 0, "NEW AreaNode for mesh ");
246 areaNode_->set_round_points(true);
247 areaNode_->enable_alpha_test(0.5);
248 areaNode_->set_point_size(7.0);
249 areaNode_->set_color(ACG::Vec4f(0.4f, 0.4f, 1.0f, 1.0f));
250 // Status nodes are handled specially by their StatusViewNodeT parent which
251 // is why they get a NONE draw mode.
252 areaNode_->drawMode(ACG::SceneGraph::DrawModes::NONE);
253
254 // Node showing handle region
255 handleNode_ = new ACG::SceneGraph::StatusNodeT<MeshT, HandleNodeMod<MeshT> >(*mesh_, 0, "NEW HandleNode for mesh ");
256 handleNode_->set_round_points(true);
257 handleNode_->enable_alpha_test(0.5);
258 handleNode_->set_line_width(2.0);
259 handleNode_->set_point_size(7.0);
260 handleNode_->set_color(ACG::Vec4f(0.2f, 1.0f, 0.2f, 1.0f));
261 // Status nodes are handled specially by their StatusViewNodeT parent which
262 // is why they get a NONE draw mode.
263 handleNode_->drawMode(ACG::SceneGraph::DrawModes::NONE);
264
265 // Node showing feature selection
266 featureNode_ = new ACG::SceneGraph::StatusNodeT<MeshT, FeatureNodeMod<MeshT> >(*mesh_, 0, "NEW FeatureNode for mesh ");
267 featureNode_->set_round_points(true);
268 featureNode_->enable_alpha_test(0.5);
269 featureNode_->set_line_width(2.0);
270 featureNode_->set_point_size(7.0);
271 featureNode_->set_color(ACG::Vec4f(1.0f, 0.2f, 1.0f, 1.0f));
272 featureNode_->set_base_color(ACG::Vec4f(1.0f, 0.2f, 1.0f, 1.0f));
273 // Status nodes are handled specially by their StatusViewNodeT parent which
274 // is why they get a NONE draw mode.
275 featureNode_->drawMode(ACG::SceneGraph::DrawModes::NONE);
276
277 // Link the status nodes to the draw mesh of the mesh below them to reuse its buffers
278 if (meshNode_) {
279 statusNode_->setDrawMesh(meshNode_->getDrawMesh());
280 featureNode_->setDrawMesh(meshNode_->getDrawMesh());
281 areaNode_->setDrawMesh(meshNode_->getDrawMesh());
282 handleNode_->setDrawMesh(meshNode_->getDrawMesh());
283 }
284
285 // Node rendering selections in correct order
286 statusView_ = new ACG::SceneGraph::StatusViewNodeT<MeshT>(manipulatorNode(), "NEW StatusViewNode for mesh ",
287 statusNode_,
288 areaNode_,
289 handleNode_,
290 featureNode_);
291
292 // make StatusViewNode parent of status nodes
293 statusNode_->set_parent(statusView_);
294 areaNode_->set_parent(statusView_);
295 handleNode_->set_parent(statusView_);
296 featureNode_->set_parent(statusView_);
297
298 // Update all nodes
299 update();
300 }
301
302 // ===============================================================================
303 // Name/Path Handling
304 // ===============================================================================
305
309 template < class MeshT >
310 void MeshObject< MeshT >::setName( QString _name ) {
312
313 // No update when gui is not active
314 if ( OpenFlipper::Options::nogui() )
315 return;
316
317 std::string nodename = std::string("StatusNode for mesh " + _name.toUtf8() );
318 statusNode_->name( nodename );
319
320 nodename = std::string("AreaNode for mesh " + _name.toUtf8() );
321 areaNode_->name( nodename );
322
323 nodename = std::string("HandleNode for mesh " + _name.toUtf8() );
324 handleNode_->name( nodename );
326 nodename = std::string("FeatureNode for mesh " + _name.toUtf8() );
327 featureNode_->name( nodename );
328
329 nodename = std::string("TextureNode for mesh "+ _name.toUtf8() );
330 textureNode_->name( nodename );
331
332 nodename = std::string("ShaderNode for mesh "+ _name.toUtf8() );
333 shaderNode_->name( nodename );
334
335 nodename = std::string("MeshNode for mesh " + _name.toUtf8() );
336 meshNode_->name( nodename );
337
338 nodename = std::string("StatusViewNode for mesh " + _name.toUtf8() );
339 statusView_->name( nodename );
340 }
341
342 // ===============================================================================
343 // Content
344 // ===============================================================================
345
349 template < class MeshT >
351 return mesh_;
352 }
353
357 template < class MeshT >
359 return mesh_;
360 }
361
366 template < class MeshT >
368
369 // No update necessary if no gui
370 if ( OpenFlipper::Options::nogui() )
371 return;
372
374
376 updateGeometry();
377 updateColor();
378 updateTopology();
379 updateSelection();
380 updateFeatures();
381 updateModelingRegions();
382 updateTexture();
383 }
384 else
386 if ( _type.contains(UPDATE_GEOMETRY) ) {
387 updateGeometry();
388 }
389 if ( _type.contains(UPDATE_SELECTION) ) {
390 updateSelection();
391 updateFeatures();
392 updateModelingRegions();
393 }
394 if ( _type.contains(UPDATE_COLOR) ) {
395 updateColor();
396 }
397 if ( _type.contains(UPDATE_TEXTURE)) {
398 updateTexture();
399 }
400 }
401 }
402
404 template < class MeshT >
406
407 if ( statusNode_ ){
408 statusNode_->updateSelection();
409 }
410 }
411
413 template < class MeshT >
415
416 if ( meshNode_ ) {
417 meshNode_->update_geometry();
418
419 // Also update the selection nodes here.
420 // These nodes store their positions based on the mesh.
421 // So they would be at the wrong position afterwards
422 statusNode_->updateGeometry();
423 featureNode_->updateGeometry();
424 areaNode_->updateGeometry();
425 handleNode_->updateGeometry();
426
427 }
428
429 invalidateTriangleBsp();
430 }
431
433 template < class MeshT >
435 if ( meshNode_ )
436 meshNode_->update_color();
437 }
438
440 template < class MeshT >
442 if ( meshNode_ ) {
443 meshNode_->update_topology();
444 statusNode_->updateTopology();
445 featureNode_->updateTopology();
446 areaNode_->updateTopology();
447 handleNode_->updateTopology();
448 }
449 invalidateTriangleBsp();
450 }
451
453 template < class MeshT >
455 if ( areaNode_ && handleNode_ ) {
456 areaNode_->updateSelection();
457 handleNode_->updateSelection();
458 }
459 }
460
462 template < class MeshT >
464 if ( featureNode_ )
465 featureNode_->updateSelection();
466 }
467
469 template < class MeshT >
471 meshNode_->update_textures();
472 }
473
474
475 // ===============================================================================
476 // Visualization
477 // ===============================================================================
478 template < class MeshT >
480 {
481 if (statusNode_)
482 {
483 statusNode_->set_color(_color);
484 statusNode_->set_base_color(_color);
485 }
486 }
487
488 template < class MeshT >
490 {
491 if (statusNode_)
492 return statusNode_->base_color();
493 else
494 return ACG::Vec4f(-1.f,-1.f,-1.f,-1.f);
495 }
496
497 template < class MeshT >
499 {
500 if (areaNode_)
501 {
502 areaNode_->set_color(_color);
503 areaNode_->set_base_color(_color);
504 }
505 }
506 template < class MeshT >
508 {
509 if (areaNode_)
510 return areaNode_->base_color();
511 else
512 return ACG::Vec4f(-1.f,-1.f,-1.f,-1.f);
513 }
514
515 template < class MeshT >
517 {
518 if (featureNode_)
519 {
520 featureNode_->set_color(_color);
521 featureNode_->set_base_color(_color);
522 }
523 }
524 template < class MeshT >
526 {
527 if (featureNode_)
528 return featureNode_->base_color();
529 else
530 return ACG::Vec4f(-1.f,-1.f,-1.f,-1.f);
531 }
532
533 template < class MeshT >
535 {
536 if (handleNode_)
537 {
538 handleNode_->set_color(_color);
539 handleNode_->set_base_color(_color);
540 }
541 }
542 template < class MeshT >
544 {
545 if (handleNode_)
546 return handleNode_->base_color();
547 else
548 return ACG::Vec4f(-1.f,-1.f,-1.f,-1.f);
549 }
550
551
555 template < class MeshT >
559
563 template < class MeshT >
567
570 template < class MeshT >
572
573 if ( _hide ) {
575 } else {
576 statusNode_->set_status( ACG::SceneGraph::BaseNode::Active );
577 }
578
579 }
580
581 template < class MeshT >
583 if ( _hide ) {
584 featureNode_->set_status( ACG::SceneGraph::BaseNode::HideNode );
585 } else {
586 featureNode_->set_status( ACG::SceneGraph::BaseNode::Active );
587 }
588 }
589
590 template < class MeshT >
592 return ( featureNode_->status() == ACG::SceneGraph::BaseNode::Active );
593 }
594
597 template < class MeshT >
598 void MeshObject< MeshT >::hideArea( StatusBits _bit, bool _hide ) {
600
601 if ( _hide ) {
603 }else
605
606 if ( _bit & AREA ) {
607 areaNode_->set_status( status );
608 }
609
610 if ( _bit & HANDLEAREA )
611 handleNode_->set_status( status );
612
613 }
614
615 template < class MeshT >
617 return ( statusNode_->status() == ACG::SceneGraph::BaseNode::Active );
618 }
619
620 template < class MeshT >
621 bool MeshObject< MeshT >::areaVisible( StatusBits _bit ) {
622 bool status = true;
623
624 if ( _bit & AREA )
625 status &= ( areaNode_->status() == ACG::SceneGraph::BaseNode::Active );
626
627 if ( _bit & HANDLEAREA )
628 status &= ( handleNode_->status() == ACG::SceneGraph::BaseNode::Active );
629
630 return status;
631 }
632
636 template < class MeshT >
640
643 template < class MeshT >
645
646 if ( mesh_ ) {
647 _bbMin = mesh_->point(mesh_->vertex_handle(0));
648 _bbMax = mesh_->point(mesh_->vertex_handle(0));
649 for ( auto v_it : mesh_->vertices()) {
650 const ACG::Vec3d p = mesh_->point(v_it);
651 _bbMin.minimize(p);
652 _bbMax.maximize(p);
653 }
654 } else {
655 // This is basicly impossible, but just in case
656 std::cerr << "Error: No Mesh found" << std::endl;
657 }
658 }
659
660 // ===============================================================================
661 // Load/Save
662 // ===============================================================================
663
669 template < class MeshT >
670 bool MeshObject< MeshT >::loadMesh(QString _filename) {
671
672 setFromFileName(_filename);
673
674 // call the local function to update names
675 setName( name() );
676
677 std::string filename = std::string( _filename.toUtf8() );
678
679 // load file
680 bool ok = OpenMesh::IO::read_mesh( (*mesh()) , filename );
681 if (!ok)
682 {
683 if ( dataType() == typeId("TriangleMesh") )
684 std::cerr << "Main Application : Read error for Triangle Mesh at "<< filename << std::endl;
685 if ( dataType() == typeId("PolyMesh") )
686 std::cerr << "Main Application : Read error for Poly Mesh\n";
687 return false;
688 }
689
690 mesh()->update_normals();
691
692 update();
693
694 show();
695
696 return true;
697 }
698
699 // ===============================================================================
700 // Object information
701 // ===============================================================================
702
708 template < class MeshT >
710 QString output;
711
712 output += "========================================================================\n";
714
715 if ( dataType( typeId("TriangleMesh") ) )
716 output += "Object Contains Triangle Mesh : ";
717
718 if ( dataType( typeId("PolyMesh") ) )
719 output += "Object Contains Poly Mesh : ";
720
721 output += QString::number( mesh()->n_vertices() ) + " vertices, ";
722 output += QString::number( mesh()->n_edges() ) += " edges ";
723 output += QString::number( mesh()->n_faces() ) += " faces.\n";
724
725 output += "========================================================================\n";
726 return output;
727 }
728
729 // ===============================================================================
730 // Picking
731 // ===============================================================================
732
739 template < class MeshT >
740 bool MeshObject< MeshT >::picked( uint _node_idx ) {
741 return ( _node_idx == meshNode_->id() );
742 }
743
744
745 template < class MeshT >
747 if ( OpenFlipper::Options::nogui())
748 return;
749
750 meshNode_->enablePicking( _enable );
751 areaNode_->enablePicking( _enable );
752 handleNode_->enablePicking( _enable );
753 featureNode_->enablePicking( _enable );
754 textureNode_->enablePicking( _enable );
755 shaderNode_->enablePicking( _enable );
756 }
757
758 template < class MeshT >
760 return meshNode_->pickingEnabled();
761 }
762
763 // ===============================================================================
764 // Octree
765 // ===============================================================================
766
767 template < class MeshT >
770
771 if ( ! dataType( typeId("TriangleMesh") ) ) {
772 std::cerr << "Bsps are only supported for triangle meshes." << std::endl;
773 return 0;
774 }
775
776 // Create the tree if needed.
777 if ( triangle_bsp_ == 0 )
778 {
779 // create Triangle BSP
780 triangle_bsp_ = new OMTriangleBSP( *mesh() );
781
782 // build Triangle BSP
783 triangle_bsp_->reserve(mesh()->n_faces());
784
785 typename MeshT::FIter f_it = mesh()->faces_begin();
786 typename MeshT::FIter f_end = mesh()->faces_end();
787
788 for (; f_it!=f_end; ++f_it)
789 triangle_bsp_->push_back(*f_it);
790
791 triangle_bsp_->build(10, 100); //max vertices per leaf 10, max depth 100
792 }
793
794 // return pointer to triangle bsp
795 return triangle_bsp_;
796 }
797
798 template < class MeshT >
801 if ( triangle_bsp_ != 0 )
802 {
803 delete triangle_bsp_;
804 triangle_bsp_ = 0;
805 }
806
807 return requestTriangleBsp();
808 }
809
810 template < class MeshT >
811 void
813 if ( triangle_bsp_ != 0 )
814 {
815 delete triangle_bsp_;
816 triangle_bsp_ = 0;
817 }
818 }
819
820
821 template < class MeshT >
822 bool
824 return triangle_bsp_ != 0;
825 }
826
827
828 //=============================================================================
829
830 template < class MeshT >
831 BaseNode*
833 return boundingBoxNode();
834 }
835
836 //=============================================================================
837
DLLEXPORT DataType typeId(QString _name)
Given a dataType Identifier string this function will return the id of the datatype.
Definition Types.cc:139
@ HideNode
Hide this node, but draw children.
Definition BaseNode.hh:394
@ Active
Draw node & children.
Definition BaseNode.hh:392
void set_status(StatusMode _s)
Set the status of this node.
Definition BaseNode.hh:403
void setDrawMesh(DrawMeshT< Mesh > *_drawmesh)
Set drawmesh.
virtual void setName(QString _name) override
path to the file from which the object is loaded ( defaults to "." )
virtual void cleanup() override
virtual QString getObjectinfo()
Get all Info for the Object as a string.
QString name() const
return the name of the object. The name defaults to NONAME if unset.
Predefined datatypes.
Definition DataTypes.hh:83
bool areaVisible(StatusBits _bit)
Return if the selected areas are currently visible.
QString getObjectinfo()
Get all Info for the Object as a string.
void updateTexture()
Update Texture of all data structures.
BaseNode * primaryNode()
Status Node for a mesh, visualizing the selection state of a mesh.
ACG::Vec4f selectionColor() const
get color for selection. returns -1 vector, if handle node does not exists
MeshT * mesh_
pointer to the mesh
bool featuresVisible()
return if the feature Node of the object is currently visible
void invalidateTriangleBsp()
void hideFeatures(bool _hide)
Hide or show the feature Node of the object.
bool hasBsp() const
check if a BSP has been computed and is valid
OMTriangleBSP * requestTriangleBsp()
virtual ~MeshObject()
destructor
void updateSelection()
Call this function to update the modeling regions.
OMTriangleBSP * resetTriangleBsp()
bool selectionVisible()
return if the selections are currently visible
void setHandleColor(const ACG::Vec4f &_color)
set color for handles
bool pickingEnabled()
Check if picking is enabled for this Node.
void setAreaColor(const ACG::Vec4f &_color)
set color for areas
void updateGeometry()
Update Geometry of all data structures.
ACG::SceneGraph::MeshNodeT< MeshT > * meshNode()
Get the Scenegraph Mesh Node.
void boundingBox(ACG::Vec3d &_bbMin, typename ACG::Vec3d &_bbMax)
Get the BoundingBox of this object.
MeshT * mesh()
return a pointer to the mesh
ACG::Vec4f areaColor() const
get color for areas. returns -1 vector, if handle node does not exists
ACG::Vec4f featureColor() const
get color for features. returns -1 vector, if handle node does not exists
MeshObject(const MeshObject &_object)
copy constructor
void setFeatureColor(const ACG::Vec4f &_color)
set color for features
void enablePicking(bool _enable)
Enable or disable picking for this Node.
void hideSelection(bool _hide)
Hide or show the selection Node of the object.
virtual void cleanup()
Reset current object, including all related nodes.
void updateColor()
Update Colors of all data structures.
ACG::SceneGraph::EnvMapNode * textureNode()
Get the TextureNode of the current mesh.
ACG::Vec4f handleColor() const
get color for handles. returns -1 vector, if handle node does not exists
void setName(QString _name)
Set the name of the Object.
virtual void update(UpdateType _type=UPDATE_ALL)
Update the whole Object (Selection,Topology,...)
void hideArea(StatusBits _bit, bool _hide)
Hide or show the area Nodes of the object.
void updateFeatures()
Update Feature Visualization Node.
void updateModelingRegions()
Call this function to update the modeling regions.
ACG::SceneGraph::ShaderNode * shaderNode()
Return pointer to the shader node.
bool loadMesh(QString _filename)
Load a mesh from the given file.
bool picked(uint _node_idx)
detect if the node has been picked
void updateTopology()
Update Topology of all data structures.
virtual void init(MeshT *_mesh=0)
Initialise current object, including all related nodes.
void setSelectionColor(const ACG::Vec4f &_color)
set color for selection
void update_normals()
Compute normals for all primitives.
vector_type & maximize(const vector_type &_rhs)
maximize values: same as *this = max(*this, _rhs), but faster
Definition Vector11T.hh:588
vector_type & minimize(const vector_type &_rhs)
minimize values: same as *this = min(*this, _rhs), but faster
Definition Vector11T.hh:560
Update type class.
Definition UpdateType.hh:59
bool contains(const UpdateType &_type) const
Check if this update contains the given UpdateType.
Definition UpdateType.cc:99
const UpdateType UPDATE_TEXTURE(UpdateTypeSet(2048))
Textures have changed.
const UpdateType UPDATE_TOPOLOGY(UpdateTypeSet(8))
Topology updated.
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
const UpdateType UPDATE_GEOMETRY(UpdateTypeSet(4))
Geometry updated.
const UpdateType UPDATE_COLOR(UpdateTypeSet(1024))
Colors have changed.
const UpdateType UPDATE_SELECTION(UpdateTypeSet(16))
Selection updated.
DrawMode SOLID_PHONG_SHADED
draw phong shaded faces
Definition DrawModes.cc:83
DrawMode NONE
not a valid draw mode
Definition DrawModes.cc:71
VectorT< float, 4 > Vec4f
Definition VectorT.hh:138
bool read_mesh(Mesh &_mesh, const std::string &_filename)
Read a mesh from file _filename.
Definition MeshIO.hh:95
void setMainGLContext()
Set current GL Context to main context.