63 #include <../ObjectTypes/TriangleMesh/TriangleMesh.hh>
64 #include <../ObjectTypes/PolyMesh/PolyMesh.hh>
66 #include "PluginFunctionsCore.hh"
80 static std::vector< glViewer* > examiner_widgets_;
86 static std::vector< Viewer::ViewerProperties* > viewerProperties_;
92 static unsigned int activeExaminer_ = 0;
94 static bool internalLightHandling_ =
true;
133 static QGLWidget* shareGLWidget_ = 0;
137 static int viewerId_ = 0;
140 static int objectCounter_ = 0;
143 static int targetCounter_ = 0;
146 static std::map<int, BaseObject*> objectMap_;
156 return examiner_widgets_.size();
160 internalLightHandling_ =
false;
164 return internalLightHandling_;
172 PluginFunctions::examiner_widgets_ = _viewerWidgets;
173 PluginFunctions::examiner_widget_ = examiner_widgets_[0];
176 QTime time = QTime::currentTime();
177 qsrand( time.hour() * 10 + time.minute() * 100 + time.second() * 1000 + time.msec() * 10000 );
182 PluginFunctions::viewerProperties_ = _viewerProperties;
186 activeExaminer_ = _id;
190 if ( _viewerId < 0 || _viewerId >= (
int)examiner_widgets_.size() ) {
191 std::cerr <<
"Requested unknown viewer with id : " << _viewerId << std::endl;
195 return( examiner_widgets_[_viewerId] );
199 return activeExaminer_;
211 if ( _viewerId < 0 || _viewerId >= (
int)examiner_widgets_.size() ) {
212 std::cerr <<
"Requested unknown viewer with id : " << _viewerId << std::endl;
217 examiner_widgets_[_viewerId]->encodeView ( view );
228 if ( _viewerId < 0 || _viewerId >= (
int)examiner_widgets_.size() ) {
229 std::cerr <<
"Requested unknown viewer with id : " << _viewerId << std::endl;
233 examiner_widgets_[_viewerId]->decodeView ( _view );
241 PluginFunctions::dataSeparatorNode_ = _dataSeparatorNode;
244 if ( PluginFunctions::dataSeparatorNode_->nChildren() != 1 ){
245 std::cerr <<
"Only one child allowed for dataSeparatorNode on initialization!" << std::endl;
246 std::cerr <<
"The Core has initialized the scenegraph in a strange way!" << std::endl;
256 PluginFunctions::sceneGraphRootNode_ = _root_node;
260 PluginFunctions::sceneGraphRootNodeGlobal_ = _root_node;
265 if ( o_it->picked( _node_idx ) ) {
275 _identifiers.clear();
278 if ( o_it->source() )
279 _identifiers.push_back ( o_it->id() );
281 return ( ! _identifiers.empty() );
285 _identifiers.clear();
288 if ( o_it->target() )
289 _identifiers.push_back ( o_it->id() );
291 return ( !_identifiers.empty() );
300 if ( _identifier == -1 )
307 std::map<int, BaseObject*>::iterator it;
308 it = objectMap_.find(_identifier);
310 _object = (it != objectMap_.end() ? it->second : 0);
312 return ( _object != 0 );
317 if ( _identifier == -1 )
323 std::map<int, BaseObject*>::iterator it;
324 it = objectMap_.find(_identifier);
326 BaseObject*
object = (it != objectMap_.end() ? it->second : 0);
329 return ( _object != 0 );
333 if(_name.isEmpty())
return -1;
336 return object ?
object->
id() : -1;
344 if ( _identifier == -1 )
348 return (
object != 0 );
355 _identifiers.clear();
360 _identifiers.push_back( o_it->id() );
363 return (!_identifiers.empty());
368 _identifiers.clear();
373 _identifiers.push_back( o_it->id() );
376 return ( !_identifiers.empty() );
380 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
386 if ( (_viewer != ACTIVE_VIEWER ) && ( ( _viewer < 0 ) || _viewer >= (
int)examiner_widgets_.size()) ){
387 std::cerr <<
"Unable to set fixed view. Wrong viewer id (" << _viewer <<
")" << std::endl;
421 if ( _viewer == ACTIVE_VIEWER )
428 return examiner_widgets_[activeExaminer_]->glMapToGlobal(_point);
432 return examiner_widgets_[activeExaminer_]->glMapFromGlobal(_point);
437 if ( _viewer == ACTIVE_VIEWER )
439 else if ( _viewer == ALL_VIEWERS )
440 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
442 else if ( ( _viewer >= 0 ) && _viewer < (
int)examiner_widgets_.size() )
445 std::cerr <<
"Requested illegal viewer for setting DrawMode!!" << std::endl;
455 if ( _viewer == ACTIVE_VIEWER ) {
457 }
else if ( _viewer == ALL_VIEWERS )
458 std::cerr <<
"Please select viewer to get viewing direction!" << std::endl;
459 else if ( ( _viewer >= 0 ) && _viewer < (
int)examiner_widgets_.size() )
462 std::cerr <<
"Requested illegal viewer for viewingDirection!!" << std::endl;
471 viewingRay(_x,_y,_outOrigin,_outDirection,activeExaminer_);
484 return examiner_widgets_[activeExaminer_]->pick( _pickTarget,_mousePos,_nodeIdx,_targetIdx,_hitPointPtr );
490 if ( _examiner >= examiner_widgets_.size() ) {
491 std::cerr <<
"Wrong examiner id" << std::endl;
494 return examiner_widgets_[_examiner]->pick( _pickTarget,_mousePos,_nodeIdx,_targetIdx,_hitPointPtr );
501 const QPoint & _mousePos,
503 unsigned int & _targetIdx,
507 unsigned int nodeIdx = 0;
509 bool ok =
scenegraphPick(_examiner,_pickTarget,_mousePos,nodeIdx,_targetIdx,_hitPointPtr);
514 if ( _refine && (_hitPointPtr != 0) ) {
517 double x = _mousePos.x();
518 double y = examiner_widget_->
glHeight() - _mousePos.y();
525 *_hitPointPtr = _object->
refinePick(_pickTarget,*_hitPointPtr, mousePoint3d , direction , _targetIdx );
536 const QPoint & _mousePos,
538 unsigned int & _targetIdx,
542 return scenegraphPick(activeExaminer_,_pickTarget,_mousePos, _object,_targetIdx,_refine,_hitPointPtr );
550 const QRegion& _region,
551 QList<QPair<unsigned int, unsigned int> >& _list,
552 QVector<float>* _depths,
553 QVector<ACG::Vec3d>* _points)
555 return examiner_widgets_[activeExaminer_]->pick_region( _pickTarget, _region, _list, _depths, _points);
560 const QRegion& _region,
561 QList<QPair<unsigned int, unsigned int> >& _list,
562 QVector<float>* _depths,
563 QVector<ACG::Vec3d>* _points)
565 if ( _examiner >= examiner_widgets_.size() ) {
566 std::cerr <<
"Wrong examiner id" << std::endl;
569 return examiner_widgets_[_examiner]->pick_region( _pickTarget, _region, _list, _depths, _points);
601 shareGLWidget_ = _widget;
606 return shareGLWidget_;
614 if ( _id >= (
int)viewerProperties_.size() ) {
615 std::cerr <<
" Error, requested properties for non-existing Viewer!" << std::endl;
616 return dummyProperties;
620 _id = activeExaminer_;
622 return ( *viewerProperties_[_id] );
627 if ( _viewer == ACTIVE_VIEWER ) {
628 examiner_widgets_[activeExaminer_]->perspectiveProjection();
629 }
else if ( _viewer == ALL_VIEWERS )
630 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
632 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
635 std::cerr <<
"Requested illegal viewer for perspectiveProjection()!!" << std::endl;
639 if ( _viewer == ACTIVE_VIEWER ) {
640 examiner_widgets_[activeExaminer_]->orthographicProjection();
641 }
else if ( _viewer == ALL_VIEWERS )
642 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
644 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
647 std::cerr <<
"Requested illegal viewer for orthographicProjection()!!" << std::endl;
653 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
654 examiner_widgets_[i]->
setFOVY(_fovy);
658 if ( _viewer == ACTIVE_VIEWER ) {
659 examiner_widgets_[activeExaminer_]->allowRotation(_mode);
660 }
else if ( _viewer == ALL_VIEWERS )
661 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
663 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
666 std::cerr <<
"Requested illegal viewer for allowRotation!!" << std::endl;
670 if ( _viewer == ACTIVE_VIEWER )
678 if ( ( _viewer >= 0 ) && _viewer < (
int)examiner_widgets_.size() )
682 std::cerr <<
"Requested illegal viewer for isRotationAllowed!!" << std::endl;
692 if ( _viewer == ACTIVE_VIEWER ) {
693 examiner_widgets_[activeExaminer_]->viewingDirection(_dir,_up);
694 }
else if ( _viewer == ALL_VIEWERS )
695 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
697 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
700 std::cerr <<
"Requested illegal viewer for viewingDirection!!" << std::endl;
705 if ( _viewer == ACTIVE_VIEWER ) {
706 examiner_widgets_[activeExaminer_]->lookAt(_eye,_center, _up);
707 }
else if ( _viewer == ALL_VIEWERS )
708 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
709 examiner_widgets_[i]->
lookAt(_eye,_center, _up);
710 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
711 examiner_widgets_[_viewer]->
lookAt(_eye,_center, _up);
713 std::cerr <<
"Requested illegal viewer for viewingDirection!!" << std::endl;
717 if ( _viewer == ACTIVE_VIEWER ) {
718 return examiner_widgets_[activeExaminer_]->trackBallCenter();
719 }
else if ( _viewer == ALL_VIEWERS )
720 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
722 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
725 std::cerr <<
"Requested illegal viewer for setTrackBallCenter!!" << std::endl;
727 return examiner_widgets_[activeExaminer_]->trackBallCenter();
731 if ( _viewer == ACTIVE_VIEWER ) {
732 examiner_widgets_[activeExaminer_]->setTrackBallCenter( _center );
733 }
else if ( _viewer == ALL_VIEWERS )
734 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
736 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
739 std::cerr <<
"Requested illegal viewer for setTrackBallCenter!!" << std::endl;
743 if ( _viewer == ACTIVE_VIEWER ) {
744 examiner_widgets_[activeExaminer_]->setScenePos( _center, _radius );
745 }
else if ( _viewer == ALL_VIEWERS )
746 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
747 examiner_widgets_[i]->
setScenePos( _center, _radius );
748 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
749 examiner_widgets_[_viewer]->
setScenePos( _center, _radius );
751 std::cerr <<
"Requested illegal viewer for setScenePos!!" << std::endl;
755 if ( _viewer == ACTIVE_VIEWER ) {
756 examiner_widgets_[activeExaminer_]->setScenePos( _center, examiner_widgets_[activeExaminer_]->scene_radius() );
757 }
else if ( _viewer == ALL_VIEWERS )
758 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
759 examiner_widgets_[i]->
setScenePos( _center, examiner_widgets_[i]->scene_radius() );
760 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
761 examiner_widgets_[_viewer]->
setScenePos( _center, examiner_widgets_[_viewer]->scene_radius() );
763 std::cerr <<
"Requested illegal viewer for setScenePos!!" << std::endl;
768 if (_viewer == ACTIVE_VIEWER) {
769 examiner_widgets_[activeExaminer_]->setSceneCenter(_center);
770 }
else if (_viewer == ALL_VIEWERS) {
772 for (uint i = 0; i < examiner_widgets_.size(); ++i) {
773 examiner_widgets_[i]->setSceneCenter(_center);
775 }
else if ((_viewer >= 0) && _viewer < (
int) examiner_widgets_.size()) {
776 examiner_widgets_[_viewer]->setSceneCenter(_center);
778 std::cerr <<
"Requested illegal viewer for setSceneCenter!!" << std::endl;
784 if (_viewer == ACTIVE_VIEWER) {
785 return examiner_widgets_[activeExaminer_]->scene_center();
786 }
else if (_viewer == ALL_VIEWERS)
787 std::cerr <<
"Please select viewer to get sceneCenter!" << std::endl;
788 else if ((_viewer >= 0) && _viewer < (
int) examiner_widgets_.size())
789 return examiner_widgets_[_viewer]->scene_center();
791 std::cerr <<
"Requested illegal viewer for sceneCenter!!" << std::endl;
793 return examiner_widgets_[activeExaminer_]->scene_center();
797 return examiner_widgets_[activeExaminer_]->scene_radius();
801 if ( _viewer == ACTIVE_VIEWER ) {
802 return examiner_widgets_[activeExaminer_]->scene_radius();
803 }
else if ( _viewer == ALL_VIEWERS )
804 std::cerr <<
"Illegal request for scene radius. Please select one viewer!" << std::endl;
805 else if ( ( _viewer >= 0 ) && _viewer < (
int)examiner_widgets_.size() )
806 return examiner_widgets_[_viewer]->scene_radius();
808 std::cerr <<
"Requested illegal viewer for translate!!" << std::endl;
814 if ( _viewer == ACTIVE_VIEWER ) {
815 examiner_widgets_[activeExaminer_]->setSceneRadius(_radius);
816 }
else if ( _viewer == ALL_VIEWERS )
817 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
819 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
822 std::cerr <<
"Requested illegal viewer for translate!!" << std::endl;
826 if ( _viewer == ACTIVE_VIEWER ) {
827 examiner_widgets_[activeExaminer_]->translate(_vector);
828 }
else if ( _viewer == ALL_VIEWERS )
829 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
830 examiner_widgets_[i]->
translate(_vector);
831 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
832 examiner_widgets_[_viewer]->
translate(_vector);
834 std::cerr <<
"Requested illegal viewer for translate!!" << std::endl;
842 if ( _viewer == ACTIVE_VIEWER ) {
843 examiner_widgets_[activeExaminer_]->rotate(_axis,_angle,_center);
844 }
else if ( _viewer == ALL_VIEWERS )
845 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
846 examiner_widgets_[i]->
rotate(_axis,_angle,_center);
847 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
848 examiner_widgets_[_viewer]->
rotate(_axis,_angle,_center);
850 std::cerr <<
"Requested illegal viewer for rotate!!" << std::endl;
854 if ( _viewer == ACTIVE_VIEWER ) {
855 examiner_widgets_[activeExaminer_]->home();
856 }
else if ( _viewer == ALL_VIEWERS )
857 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
858 examiner_widgets_[i]->home();
859 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
860 examiner_widgets_[_viewer]->home();
862 std::cerr <<
"Requested illegal viewer for viewHome!!" << std::endl;
866 if ( _viewer == ACTIVE_VIEWER ) {
867 examiner_widgets_[activeExaminer_]->viewAll();
868 }
else if ( _viewer == ALL_VIEWERS )
869 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
870 examiner_widgets_[i]->
viewAll();
871 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
872 examiner_widgets_[_viewer]->
viewAll();
874 std::cerr <<
"Requested illegal viewer for viewAll!!" << std::endl;
878 if ( _viewer == ACTIVE_VIEWER ) {
880 }
else if ( _viewer == ALL_VIEWERS )
881 std::cerr <<
"Please select viewer to get viewing direction!" << std::endl;
882 else if ( ( _viewer >= 0 ) && _viewer < (
int)examiner_widgets_.size() )
885 std::cerr <<
"Requested illegal viewer for viewingDirection!!" << std::endl;
892 if ( _viewer == ACTIVE_VIEWER) {
893 return (examiner_widgets_[activeExaminer_]->projectionMode() == 0);
894 }
else if ( ( _viewer >= 0 ) && _viewer < (
int)examiner_widgets_.size() ){
895 return ( examiner_widgets_[_viewer]->projectionMode() == 0);
897 std::cerr <<
"Requested illegal viewer for isProjectionOrthographic!!" << std::endl;
903 if ( _viewer == ACTIVE_VIEWER ) {
905 }
else if ( _viewer == ALL_VIEWERS )
906 std::cerr <<
"Please select viewer to get eyePos!" << std::endl;
907 else if ( ( _viewer >= 0 ) && _viewer < (
int)examiner_widgets_.size() )
910 std::cerr <<
"Requested illegal viewer for eyePos!!" << std::endl;
916 if ( _viewer == ACTIVE_VIEWER ) {
918 }
else if ( _viewer == ALL_VIEWERS )
919 std::cerr <<
"Please select viewer to get up vector!" << std::endl;
920 else if ( ( _viewer >= 0 ) && _viewer < (
int)examiner_widgets_.size() )
923 std::cerr <<
"Requested illegal viewer for up vector!!" << std::endl;
932 if ( _viewer == ACTIVE_VIEWER ) {
934 }
else if ( _viewer == ALL_VIEWERS )
935 std::cerr <<
"Please select viewer to get fovy!" << std::endl;
936 else if ( ( _viewer >= 0 ) && _viewer < (
int)examiner_widgets_.size() )
939 std::cerr <<
"Requested illegal viewer for fovy!!" << std::endl;
946 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
952 defaultMarker_ = _marker;
957 return defaultMarker_;
962 return PluginFunctions::sceneGraphRootNode_;
966 return PluginFunctions::dataRootNode_;
970 if (PluginFunctions::sceneGraphRootNode_){
984 if (PluginFunctions::sceneGraphRootNode_)
985 _node->
set_parent( PluginFunctions::sceneGraphRootNodeGlobal_ );
990 if (PluginFunctions::sceneGraphRootNode_){
1005 return(objectCounter_);
1011 return ( targetCounter_ );
1032 if ( o_it->visible() )
1052 _objects.push_back( *o_it );
1060 examiner_widgets_[activeExaminer_]->flyTo(_position,_center,_time);
1068 ACG::Vec3d e = eye + t * (_move_back ? -0.5f : 0.5f);
1069 examiner_widgets_[activeExaminer_]->flyTo(e, _center, _time);
1074 void viewerSnapshot(
int _viewer, QImage& _image,
int _width,
int _height,
bool _alpha,
1075 bool _hideCoordsys,
int _samples) {
1077 if ( _viewer == ACTIVE_VIEWER ) {
1078 examiner_widgets_[activeExaminer_]->snapshot(_image, _width, _height, _alpha, _hideCoordsys, _samples);
1079 }
else if ( _viewer == ALL_VIEWERS )
1080 std::cerr <<
"Please select viewer to get snapshot!" << std::endl;
1081 else if ( ( _viewer >= 0 ) && _viewer < (
int)examiner_widgets_.size() )
1082 examiner_widgets_[_viewer]->snapshot(_image, _width, _height, _alpha, _hideCoordsys, _samples);
1084 std::cerr <<
"Requested illegal viewer for snapshot!!" << std::endl;
1104 return (objectRoot_);
1115 if ( objectCounter_ < 0 )
1116 std::cerr <<
"Deleted more objects than created!!!" << std::endl;
1127 if ( targetCounter_ < 0 )
1128 std::cerr <<
"target object counter underflow!!!" << std::endl;
1137 std::map<int, BaseObject*>::iterator it;
1138 it = objectMap_.find(_objectId);
1140 if(it != objectMap_.end())
return;
1143 objectMap_.insert(std::pair<int, BaseObject*>(_objectId, _object));
1152 std::map<int, BaseObject*>::iterator it;
1153 it = objectMap_.find(_objectId);
1156 if(it != objectMap_.end()) objectMap_.erase(it);
1163 if ( sceneGraphGenerators_.contains( _generator->
handles() ) )
1167 sceneGraphGenerators_[_generator->
handles() ] = _generator;
1176 QWidget * parent,
const QString & caption,
1177 const QString & defaultDir,
const QString & filter,
1178 QString * selectedFilter, QFileDialog::Options options) {
1181 const QString result = QFileDialog::getOpenFileName(parent, caption, dir,
1182 filter, selectedFilter, options);
1183 if (result.length())
1189 QWidget * parent,
const QString & caption,
1190 const QString & defaultDir,
const QString & filter,
1191 QString * selectedFilter, QFileDialog::Options options,
1192 const QString & defaultSuffix) {
1204 QFileDialog dialog(parent, caption, dir, filter);
1205 dialog.setOptions(options);
1206 dialog.setAcceptMode(QFileDialog::AcceptSave);
1207 if (selectedFilter && !selectedFilter->isEmpty())
1208 dialog.selectNameFilter(*selectedFilter);
1209 dialog.setDefaultSuffix(defaultSuffix);
1210 if (dialog.exec() == QDialog::Accepted) {
1212 *selectedFilter = dialog.selectedNameFilter();
1213 QString result = dialog.selectedFiles().value(0);
1224 if (visibleOnly && !o_it->visible())
continue;
1226 result.append(o_it->getAllCommentsFlat());
1232 if (!ACG::SceneGraph::Material::support_json_serialization())
1233 return QStringList();
1238 if (visibleOnly && !o_it->visible())
continue;
1240 QString materialStr(QObject::tr(
"<not available>"));
1241 if (!o_it->materialNode())
1242 materialStr = QObject::tr(
"<not available: materialNode == null>");
1244 materialStr = o_it->materialNode()->material().serializeToJson();
1246 if (!result.empty())
1247 result.last().append(QString::fromUtf8(
","));
1248 result.append(QString::fromUtf8(
"\"%1\": %2").arg(o_it->name()).arg(materialStr));
1253 void invalidatePickCaches() {
1254 for(
size_t i = 0; i < examiner_widgets_.size(); ++i) {
1255 examiner_widgets_[i]->invalidatePickCache();
DLLEXPORT OpenFlipperQSettings & OpenFlipperSettings()
QSettings object containing all program settings of OpenFlipper.
void decreaseObjectCount()
Increase the number of current Object.
DLLEXPORT DataType typeId(QString _name)
Given a dataType Identifier string this function will return the id of the datatype.
int viewerId()
Return unique viewer id.
void perspectiveProjection(int _viewer)
Switch to perspective Projection.
ACG::SceneGraph::DrawModes::DrawMode drawMode(int _viewer)
Get the current draw Mode of a Viewer.
Viewer::ViewerProperties & viewerProperties(int _id)
Get the viewer properties Use this functions to get basic viewer properties such as backgroundcolor o...
void translate(const ACG::Vec3d &_vector, int _viewer)
Translate viewer pos by given vector.
const QStringList ALL_OBJECTS
Iterable object range.
void setViewObjectMarker(ViewObjectMarker *_marker)
void setSceneRadius(double _radius, int _viewer)
Set the background color of the examiner widget.
void allowRotation(bool _mode, int _viewer)
PickTarget
What target to use for picking.
int getObjectId(const QString &_name)
void disableExaminerLightHandling()
Disable the core light handling.
void setViewerProperties(std::vector< Viewer::ViewerProperties * > _viewerProperties)
Set the internal viewerProperties pointer ( DO NOT USE!! )
virtual void snapshot(int _width=0, int _height=0, bool _alpha=false, bool _hideCoordsys=false, int samples=1)
int targetCount()
Get the number of target objects.
const ACG::Vec3d sceneCenter(int _viewer)
Get the current scene center.
int visibleCount()
Get the number of visible objects.
void viewingDirection(const ACG::Vec3d &_dir, const ACG::Vec3d &_up, int _viewer)
Set the viewing direction.
bool getObject(int _identifier, BSplineCurveObject *&_object)
const QStringList SOURCE_OBJECTS("source")
Iterable object range.
void setTrackBallCenter(const ACG::Vec3d &_center, int _viewer)
Set the trackball Center.
void setSceneGraphRootNode(SeparatorNode *_root_node)
QPoint mapToGlobal(const QPoint _point)
Map coordinates of GL Widget to global coordinates.
bool getSourceIdentifiers(std::vector< int > &_identifiers)
Get the identifiers of all objects marked as a source object.
void setDrawMode(const ACG::SceneGraph::DrawModes::DrawMode &_mode, int _viewer)
Set the draw Mode of a Viewer. .
bool getAllObjectIdentifiers(std::vector< int > &_identifiers)
Get identifiers of all objects.
void setEncodedExaminerView(QString _view)
Set the encoded view for the active examiner.
bool rotationLocked()
Pointer to the glState of the Viewer.
bool examinerLightHandling()
returns if internal light handling is active.
void decreaseTargetCount()
Increase the number of current Object.
virtual ACG::Vec3d refinePick(ACG::SceneGraph::PickTarget _pickTarget, const ACG::Vec3d _hitPoint, const ACG::Vec3d _start, const ACG::Vec3d _dir, const unsigned int _targetIdx)
Refine picking.
ViewObjectMarker * defaultViewObjectMarker()
Get the default ViewObjectMarker.
virtual std::string handles()
return the type this generator handles
void drawMode(ACG::SceneGraph::DrawModes::DrawMode _mode)
set draw mode (No test if this mode is available!)
QMap< std::string,ACG::QtWidgets::SceneGraphWidgetGenerator * > getSceneGraphGeneratorList()
Add a scenegraph generator ( the handled type will be extracted from the generator) ...
ACG::SceneGraph::BaseNode * getSceneGraphRootNode()
get scenegraph root node
const QStringList TARGET_OBJECTS("target")
Iterable object range.
void rotate(const ACG::Vec3d &_axis, const double _angle, const ACG::Vec3d &_center, int _viewer)
Rotate Scene around axis.
void setSceneCenter(const ACG::Vec3d &_center, int _viewer)
QStringList collectObjectComments(bool visibleOnly, bool targetedOnly)
void setScenePos(const ACG::Vec3d &_center, const double _radius, int _viewer)
Set the Scene position.
bool scenegraphRegionPick(ACG::SceneGraph::PickTarget _pickTarget, const QRegion &_region, QList< QPair< unsigned int, unsigned int > > &_list, QVector< float > *_depths, QVector< ACG::Vec3d > *_points)
void setBackColor(OpenMesh::Vec4f _color)
Set the background color of the examiner widget.
QStringList collectObjectMaterials(bool visibleOnly, bool targetedOnly)
void objectMarker(ViewObjectMarker *_marker)
set object marker for viewer
void setActiveExaminer(const unsigned int _id)
Set the active id of the examiner which got the last mouse events.
void getCurrentViewImage(QImage &_image)
Returns a QImage of the current View.
void setSceneGraphRootNodeGlobal(SeparatorNode *_root_node)
void viewHome(int _viewer)
Go to home position.
void increaseTargetCount()
Decrease the number of current Object.
void setViewers(std::vector< glViewer * > _viewerWidgets)
Set the internal Viewer pointer ( DO NOT USE!! )
ObjectReferenceRange objectReferences(IteratorRestriction _restriction, DataType _dataType)
Iterable object range.
QMap< std::string,ACG::QtWidgets::SceneGraphWidgetGenerator * > sceneGraphGenerators_
Map of scenegraph widget generators.
void addObjectToMap(int _objectId, BaseObject *_object)
Add object to internal object map.
const std::string pickMode()
Get the current Picking mode.
const ACG::Vec3d trackBallCenter(int _viewer)
Get the trackball Center.
void setDataRoot(BaseObject *_root)
void lookAt(const ACG::Vec3d &_eye, const ACG::Vec3d &_center, const ACG::Vec3d &_up, int _viewer)
Set the look at transformation directly.
DLLEXPORT double fovy(int _viewer)
Get field of view angle.
QString getSaveFileName(const QString &configProperty, QWidget *parent, const QString &caption, const QString &defaultDir, const QString &filter, QString *selectedFilter, QFileDialog::Options options, const QString &defaultSuffix)
void set_parent(BaseNode *_parent)
Set the parent of this node.
DLLEXPORT ObjectIterator objectsEnd()
Return Iterator to Object End.
ACG::Vec3d eyePos(int _viewer)
Get the current viewer position.
void addGlobalStatusNode(ACG::SceneGraph::BaseNode *_node)
Adds a global status node.
void increaseObjectCount()
Decrease the number of current Object.
Range adapter for ObjectIterator.
BaseObject * childExists(int _objectId)
Check if the element exists in the subtree of this element.
void viewerSnapshot(int _viewer, QImage &_image, int _width, int _height, bool _alpha, bool _hideCoordsys, int _samples)
Take a snapshot of a viewer.
void set_parent(BaseNode *_parent)
Set the parent of this node.
BaseObject *& objectRoot()
Get the root of the object structure.
virtual void makeCurrent()
Makes this widget the current widget for OpenGL operations.
QString getEncodedExaminerView()
Get the encoded view for the active examiner.
QString getOpenFileName(const QString &configProperty, QWidget *parent, const QString &caption, const QString &defaultDir, const QString &filter, QString *selectedFilter, QFileDialog::Options options)
Vec3d up() const
get up-vector w.r.t. camera coordinates
void addGlobalNode(ACG::SceneGraph::BaseNode *_node)
Add a global node.
ACG::SceneGraph::BaseNode * getRootNode()
Get the root node for data objects.
int viewers()
Get the number of viewers.
void get_all_objects(std::vector< BaseObjectData * > &_objects)
double sceneRadius()
Returns the current scene radius from the active examiner widget.
double fovy() const
get field of view in y direction
const DataType DATA_ALL(UINT_MAX)
Identifier for all available objects.
void addObjectRenderingNode(ACG::SceneGraph::BaseNode *_node)
Add scenegraph node modifing object rendering.
Viewer::ActionMode actionMode()
get the action mode
void shareGLWidget(QGLWidget *_widget)
Sets the main QGLWidget for gl data sharing.
Vec3d viewing_direction() const
get viewing ray
void setFixedView(int _mode, int _viewer)
Set a fixed View for a viewer.
void setFOVY(double _fovy)
Set field of view angle.
int currentViewingDirection()
Pointer to the glState of the Viewer.
void setDefaultViewObjectMarker(ViewObjectMarker *_marker)
ChildIter childrenBegin()
Returns: begin-iterator of children.
bool getAllMeshes(std::vector< int > &_identifiers)
Get identifiers of all meshes.
bool getTargetIdentifiers(std::vector< int > &_identifiers)
Get the identifiers of all objects marked as a target object.
void addSceneGraphGenerator(ACG::QtWidgets::SceneGraphWidgetGenerator *_generator)
Add a scenegraph generator ( the handled type will be extracted from the generator) ...
int sourceCount()
Get the number of source objects.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
void viewingRay(int _x, int _y, ACG::Vec3d &_outOrigin, ACG::Vec3d &_outDirection)
Retrieve a viewing ray from the active examiner that can be used for raycasting.
QPoint mapToLocal(const QPoint _point)
Map global coordinates to GL Widget local coordinates.
bool isProjectionOrthographic(int _viewer)
Check if the projection is orthographic.
int objectCount()
Get the number of available objects.
bool scenegraphPick(ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, unsigned int &_nodeIdx, unsigned int &_targetIdx, ACG::Vec3d *_hitPointPtr=0)
Execute picking operation on scenegraph.
BaseObjectData * baseObjectData(BaseObject *_object)
Cast an BaseObject to a BaseObjectData if possible.
QStringList IteratorRestriction
Iterable object range.
ObjectRange objects(IteratorRestriction _restriction, DataType _dataType)
Iterable object range.
unsigned int glHeight() const
get height of QGLWidget
void orthographicProjection(int _viewer)
Switch to orthographic Projection.
Viewer::ActionMode actionMode()
Get the current Action mode.
void setValue(const QString &key, const QVariant &value)
Wrapper function which makes it possible to enable Debugging output with -DOPENFLIPPER_SETTINGS_DEBUG...
ACG::GLState & glState()
Get the glState of the Viewer.
unsigned int activeExaminer()
Get the id of the examiner which got the last mouse events.
Vec3d eye() const
get eye point
void traverse(BaseNode *_node, Action &_action)
bool getPickedObject(const unsigned int _node_idx, BaseObjectData *&_object)
Get the picked mesh.
void flyTo(const ACG::Vec3d &_position, const ACG::Vec3d &_center, double _time)
Fly to point and viewing direction (animated).
glViewer * viewer(int _viewerId)
Get a Viewer.
void setMainGLContext()
Set current GL Context to main context.
void removeObjectFromMap(int _objectId)
Remove object from internal object map.
ACG::Vec3d upVector(int _viewer)
Get the current up vector.
void viewing_ray(int _x, int _y, Vec3d &_origin, Vec3d &_direction) const
std::string pickMode()
get active pick mode
void setDataSeparatorNodes(SeparatorNode *_dataSeparatorNode)
Set the internal data root node pointers ( DO NOT USE!! )
ACG::Vec4f backgroundColor()
Get current background color.
Range adapter for ObjectIterator.
void viewAll(int _viewer)
View the whole scene.
void traverse(ACG::SceneGraph::MouseEventAction &_action)
bool objectExists(const int _identifier)
Check if an object with this identifier exists.
BaseNode * parent()
Get the nodes parent node.