Commit 0f09f6d0 authored by Jan Möbius's avatar Jan Möbius

Changed function parameters for picking from using unsigned int to size_t. Breaking Change!

parent 75523dcc
......@@ -260,7 +260,7 @@ void setSceneGraphRootNodeGlobal( SeparatorNode* _root_node ) {
PluginFunctions::sceneGraphRootNodeGlobal_ = _root_node;
}
bool getPickedObject(const unsigned int _node_idx , BaseObjectData*& _object) {
bool getPickedObject(const size_t _node_idx , BaseObjectData*& _object) {
for ( ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ; o_it != PluginFunctions::objectsEnd(); ++o_it) {
if ( o_it->picked( _node_idx ) ) {
_object = *o_it;
......@@ -479,13 +479,13 @@ void viewingRay(int _x, int _y,
}
// Pick returning node index
bool scenegraphPick( ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, unsigned int &_nodeIdx, unsigned int &_targetIdx, ACG::Vec3d *_hitPointPtr=0 ) {
bool scenegraphPick( ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, size_t &_nodeIdx, size_t &_targetIdx, ACG::Vec3d *_hitPointPtr=0 ) {
return examiner_widgets_[activeExaminer_]->pick( _pickTarget,_mousePos,_nodeIdx,_targetIdx,_hitPointPtr );
}
// Pick returning node index
bool scenegraphPick( const unsigned int _examiner, ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, unsigned int &_nodeIdx, unsigned int &_targetIdx, ACG::Vec3d *_hitPointPtr=0 ) {
bool scenegraphPick( const unsigned int _examiner, ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, size_t &_nodeIdx, size_t &_targetIdx, ACG::Vec3d *_hitPointPtr=0 ) {
if ( _examiner >= examiner_widgets_.size() ) {
std::cerr << "Wrong examiner id" << std::endl;
......@@ -500,13 +500,13 @@ bool scenegraphPick( const unsigned int _examiner ,
ACG::SceneGraph::PickTarget _pickTarget,
const QPoint & _mousePos,
BaseObjectData*& _object,
unsigned int & _targetIdx,
size_t & _targetIdx,
const bool _refine,
ACG::Vec3d * _hitPointPtr ) {
unsigned int nodeIdx = 0;
size_t nodeIdx = 0;
bool ok = scenegraphPick(_examiner,_pickTarget,_mousePos,nodeIdx,_targetIdx,_hitPointPtr);
bool ok = scenegraphPick(_examiner,_pickTarget,_mousePos, nodeIdx,_targetIdx,_hitPointPtr);
// If successfully picked and object is found
if ( ok && PluginFunctions::getPickedObject(nodeIdx, _object) ) {
......@@ -535,7 +535,7 @@ bool scenegraphPick( const unsigned int _examiner ,
bool scenegraphPick( ACG::SceneGraph::PickTarget _pickTarget,
const QPoint & _mousePos,
BaseObjectData*& _object,
unsigned int & _targetIdx,
size_t & _targetIdx,
const bool _refine,
ACG::Vec3d * _hitPointPtr ) {
......@@ -548,7 +548,7 @@ bool scenegraphPick( ACG::SceneGraph::PickTarget _pickTarget,
bool scenegraphRegionPick( ACG::SceneGraph::PickTarget _pickTarget,
const QRegion& _region,
QList<QPair<unsigned int, unsigned int> >& _list,
QList<QPair<size_t, size_t> >& _list,
QVector<float>* _depths,
QVector<ACG::Vec3d>* _points)
{
......@@ -558,7 +558,7 @@ bool scenegraphRegionPick( ACG::SceneGraph::PickTarget _pickTarge
bool scenegraphRegionPick( const unsigned int _examiner,
ACG::SceneGraph::PickTarget _pickTarget,
const QRegion& _region,
QList<QPair<unsigned int, unsigned int> >& _list,
QList<QPair<size_t, size_t> >& _list,
QVector<float>* _depths,
QVector<ACG::Vec3d>* _points)
{
......
......@@ -93,7 +93,7 @@ namespace PluginFunctions {
* @return true if mesh was found, false if picked object is not a mesh or not found
*/
DLLEXPORT
bool getPickedObject(const unsigned int _node_idx , BaseObjectData*& _object);
bool getPickedObject(const size_t _node_idx , BaseObjectData*& _object);
/** @} */
......@@ -250,14 +250,14 @@ void setSceneCenter(const ACG::Vec3d& _center, int _viewer );
* set by the last mouse event from the core
*/
DLLEXPORT
bool scenegraphPick( ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, unsigned int &_nodeIdx, unsigned int &_targetIdx, ACG::Vec3d *_hitPointPtr );
bool scenegraphPick( ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, size_t &_nodeIdx, size_t &_targetIdx, ACG::Vec3d *_hitPointPtr );
/** \brief Execute picking operation on scenegraph
*
* This picking function will pick in the specified examiner context
*/
DLLEXPORT
bool scenegraphPick( const unsigned int _examiner ,ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, unsigned int &_nodeIdx, unsigned int &_targetIdx, ACG::Vec3d *_hitPointPtr );
bool scenegraphPick( const unsigned int _examiner ,ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, size_t &_nodeIdx, size_t &_targetIdx, ACG::Vec3d *_hitPointPtr );
/** \brief Execute picking operation on scenegraph and return object
*
......@@ -266,7 +266,7 @@ bool scenegraphPick( const unsigned int _examiner ,ACG::SceneGraph::PickTarget _
* the picked object will be called in order to achieve higher picking accuracy
*/
DLLEXPORT
bool scenegraphPick( const unsigned int _examiner ,ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, BaseObjectData*& _object, unsigned int &_targetIdx, const bool _refine ,ACG::Vec3d *_hitPointPtr );
bool scenegraphPick( const unsigned int _examiner ,ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, BaseObjectData*& _object, size_t &_targetIdx, const bool _refine ,ACG::Vec3d *_hitPointPtr );
/** \brief Execute picking operation on scenegraph and return object
*
......@@ -275,7 +275,7 @@ bool scenegraphPick( const unsigned int _examiner ,ACG::SceneGraph::PickTarget _
* the picked object will be called in order to achieve higher picking accuracy
*/
DLLEXPORT
bool scenegraphPick( ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, BaseObjectData*& _object, unsigned int &_targetIdx, const bool _refine, ACG::Vec3d *_hitPointPtr );
bool scenegraphPick( ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, BaseObjectData*& _object, size_t &_targetIdx, const bool _refine, ACG::Vec3d *_hitPointPtr );
/** Execute picking operation on scenegraph
......@@ -285,7 +285,7 @@ bool scenegraphPick( ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mou
DLLEXPORT
bool scenegraphRegionPick( ACG::SceneGraph::PickTarget _pickTarget,
const QRegion& _region,
QList<QPair<unsigned int, unsigned int> >& _list,
QList<QPair<size_t, size_t> >& _list,
QVector<float>* _depths = 0,
QVector<ACG::Vec3d>* _points = 0);
......@@ -296,7 +296,7 @@ DLLEXPORT
bool scenegraphRegionPick( const unsigned int _examiner,
ACG::SceneGraph::PickTarget _pickTarget,
const QRegion& _region,
QList<QPair<unsigned int, unsigned int> >& _list,
QList<QPair<size_t, size_t> >& _list,
QVector<float>* _depths = 0,
QVector<ACG::Vec3d>* _points = 0);
......
......@@ -743,7 +743,7 @@ Core::slotMouseEventIdentify( QMouseEvent* _event )
PluginFunctions::setActiveExaminer( examinerId );
// Do picking
unsigned int node_idx, target_idx;
size_t node_idx, target_idx;
ACG::Vec3d hit_point;
if(PluginFunctions::scenegraphPick(ACG::SceneGraph::PICK_ANYTHING, _event->pos(), node_idx, target_idx, &hit_point)) {
......
......@@ -2,6 +2,8 @@
- <b>OpenFlipper 4.0 ( ?/?/? )</b>
- <b>Breaking changes</b>
- Picking functions use size_t instead of unsigned int now (Required to get rid of a lot of warnings during compilation)
- <b>Build System</b>
- Enable C++-11 by default
- Drop support for Qt 4
......
......@@ -183,7 +183,7 @@ void ObjectPickDialog::activated(const QModelIndex & _index)
void ObjectPickDialog::slotMouseEventClick(QMouseEvent * _event, bool /*_double*/)
{
unsigned int nodeIdx, targetIdx;
size_t nodeIdx, targetIdx;
if (viewer_->viewer()->pick(ACG::SceneGraph::PICK_ANYTHING, _event->pos(), nodeIdx, targetIdx))
......
......@@ -679,7 +679,7 @@ void CoreWidget::updatePopupMenu(const QPoint& _point) {
} context = BACKGROUNDCONTEXT;
// Do picking in the gl area to find an object
unsigned int node_idx, target_idx;
size_t node_idx, target_idx;
ACG::Vec3d hit_point;
BaseObjectData* object = 0;
ACG::SceneGraph::BaseNode* node = 0;
......
......@@ -100,7 +100,7 @@ void CoreWidget::startDrag ( QMouseEvent* _event )
int objectId = -1;
// Do picking in the gl area to find an object
unsigned int node_idx, target_idx;
size_t node_idx, target_idx;
ACG::Vec3d hit_point;
BaseObjectData* object;
if ( PluginFunctions::scenegraphPick ( ACG::SceneGraph::PICK_ANYTHING,
......
......@@ -2431,8 +2431,8 @@ void glViewer::updateCursorPosition (QPointF _scenePos)
ACG::Vec3d tmp;
unsigned int nodeIdx = 0;
unsigned int targetIdx = 0;
size_t nodeIdx = 0;
size_t targetIdx = 0;
// ignore cursor if we are outside of our window
......
......@@ -794,10 +794,10 @@ private:
* @return Successful?
*/
bool pick( ACG::SceneGraph::PickTarget _pickTarget,
const QPoint& _mousePos,
unsigned int& _nodeIdx,
unsigned int& _targetIdx,
ACG::Vec3d* _hitPointPtr=0 );
const QPoint& _mousePos,
size_t& _nodeIdx,
size_t& _targetIdx,
ACG::Vec3d* _hitPointPtr=0 );
/** \brief Perform picking action n a whole region.
*
......@@ -814,7 +814,7 @@ private:
*/
bool pick_region( ACG::SceneGraph::PickTarget _pickTarget,
const QRegion& _region,
QList<QPair<unsigned int, unsigned int> >& _list,
QList<QPair<size_t,size_t> >& _list,
QVector<float>* _depths = 0,
QVector<ACG::Vec3d>* _points = 0);
......@@ -836,15 +836,15 @@ private:
/// pick using colors
int pickColor( ACG::SceneGraph::PickTarget _pickTarget,
const QPoint& _mousePos,
unsigned int& _nodeIdx,
unsigned int& _targetIdx,
size_t& _nodeIdx,
size_t& _targetIdx,
ACG::Vec3d* _hitPointPtr=0 );
/// pick from cache
int pickFromCache( ACG::SceneGraph::PickTarget _pickTarget,
const QPoint& _mousePos,
unsigned int& _nodeIdx,
unsigned int& _targetIdx,
size_t& _nodeIdx,
size_t& _targetIdx,
ACG::Vec3d* _hitPointPtr=0 );
private:
......
......@@ -72,7 +72,7 @@ void glViewer::flyTo(const QPoint& _pos, bool _moveBack)
{
makeCurrent();
unsigned int nodeIdx, targetIdx;
size_t nodeIdx, targetIdx;
ACG::Vec3d hitPoint;
if (pick( ACG::SceneGraph::PICK_ANYTHING, _pos, nodeIdx, targetIdx, &hitPoint))
......
......@@ -76,8 +76,8 @@
bool glViewer::pick( ACG::SceneGraph::PickTarget _pickTarget,
const QPoint& _mousePos,
unsigned int& _nodeIdx,
unsigned int& _targetIdx,
size_t& _nodeIdx,
size_t& _targetIdx,
ACG::Vec3d* _hitPointPtr )
{
if (sceneGraphRoot_)
......@@ -106,8 +106,8 @@ bool glViewer::pick( ACG::SceneGraph::PickTarget _pickTarget,
int glViewer::pickColor( ACG::SceneGraph::PickTarget _pickTarget,
const QPoint& _mousePos,
unsigned int& _nodeIdx,
unsigned int& _targetIdx,
size_t& _nodeIdx,
size_t& _targetIdx,
ACG::Vec3d* _hitPointPtr )
{
GLint w = glWidth(),
......@@ -306,8 +306,8 @@ int glViewer::pickColor( ACG::SceneGraph::PickTarget _pickTarget,
int glViewer::pickFromCache( ACG::SceneGraph::PickTarget _pickTarget,
const QPoint& _mousePos,
unsigned int& _nodeIdx,
unsigned int& _targetIdx,
size_t& _nodeIdx,
size_t& _targetIdx,
ACG::Vec3d* _hitPointPtr )
{
// do we need an update?
......@@ -416,7 +416,7 @@ int glViewer::pickFromCache( ACG::SceneGraph::PickTarget _pickTarget,
bool glViewer::pick_region( ACG::SceneGraph::PickTarget _pickTarget,
const QRegion& _region,
QList<QPair<unsigned int, unsigned int> >& _list,
QList<QPair<size_t, size_t> >& _list,
QVector<float>* _depths,
QVector<ACG::Vec3d>* _points)
{
......@@ -565,7 +565,7 @@ bool glViewer::pick_region( ACG::SceneGraph::PickTarget _pickTarg
if (rv.size () < 2)
continue;
QPair<unsigned int, unsigned int> curr(rv[1], rv[0]);
QPair<size_t, size_t> curr(rv[1], rv[0]);
// added a new (targetidx/nodeidx) pair
if( !_list.contains(curr))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment