Commit 12a8ad90 authored by Jan Möbius's avatar Jan Möbius
Browse files

Merge branch 'master' into qtcreator-workaround

parents 5b9cf0dd 0f09f6d0
......@@ -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);
......
......@@ -114,7 +114,8 @@ Core() :
nextBackupId_(0),
nextBackupGroupId_(0),
objectRoot_(0),
coreWidget_(0)
coreWidget_(0),
splash_(0)
{
//init logFile
......@@ -608,7 +609,7 @@ Core::init() {
QStringList optionFiles = OpenFlipper::Options::optionFiles();
for ( int i = 0 ; i < (int)optionFiles.size(); ++i) {
if ( OpenFlipper::Options::gui() && OpenFlipperSettings().value("Core/Gui/splash",true).toBool() ) {
if (splash_) {
splash_->showMessage(tr("Loading Configuration File %1/%2").arg(i+1).arg(optionFiles.size()),
Qt::AlignBottom | Qt::AlignLeft , Qt::white);
}
......@@ -621,7 +622,7 @@ Core::init() {
openIniFile( optionFiles[i] ,false,true,false);
}
if ( OpenFlipper::Options::gui() && OpenFlipperSettings().value("Core/Gui/splash",true).toBool() )
if (splash_)
splash_->clearMessage();
// ===============================================================================================
......@@ -674,7 +675,7 @@ Core::init() {
}
if ( OpenFlipperSettings().value("Core/Gui/splash",true).toBool() ) {
if ( splash_ ) {
splash_->raise();
splash_->showMessage(tr("Ready."), Qt::AlignBottom | Qt::AlignLeft , Qt::white);
finishSplash();
......@@ -742,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)) {
......@@ -2041,7 +2042,7 @@ void Core::showReducedMenuBar(bool reduced) {
}
void Core::finishSplash() {
splash_->finish(coreWidget_);
if (splash_) splash_->finish(coreWidget_);
}
......
......@@ -389,7 +389,7 @@ void Core::loadPlugins()
loadedPlugins.push_back(loader);
if ( OpenFlipper::Options::gui() && OpenFlipperSettings().value("Core/Gui/splash",true).toBool() ) {
if (splash_) {
splashMessage_ = tr("Loading Plugin %1/%2").arg(loadedPlugins.size()).arg(pluginlist.size()) ;
splash_->showMessage( splashMessage_ , Qt::AlignBottom | Qt::AlignLeft , Qt::white);
}
......@@ -411,7 +411,7 @@ void Core::loadPlugins()
for (std::vector<QPluginLoader*>::iterator it = loadedPlugins.begin();
it != loadedPlugins.end(); ++it) {
if ( OpenFlipper::Options::gui() && OpenFlipperSettings().value("Core/Gui/splash",true).toBool() ) {
if (splash_) {
splashMessage_ = tr("Initializing Plugin %1/%2")
.arg(std::distance(loadedPlugins.begin(), it) + 1)
.arg(loadedPlugins.size());
......@@ -770,7 +770,7 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic
emit log(LOGOUT,tr("Found Plugin : \t %1").arg(basePlugin->name()) );
if ( OpenFlipper::Options::gui() && OpenFlipperSettings().value("Core/Gui/splash",true).toBool() ) {
if (splash_) {
splashMessage_ = splashMessage_ + " " + basePlugin->name() ;
splash_->showMessage( splashMessage_ , Qt::AlignBottom | Qt::AlignLeft , Qt::white);
}
......
......@@ -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
......
......@@ -111,35 +111,64 @@
#ifdef WIN32
void attachConsole()
{
//try to attach the console of the parent process
if (AttachConsole(-1))
{
//if the console was attached change stdinput and output
freopen("CONIN$", "r", stdin);
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
}
else
{
//create and attach a new console if needed
#ifndef NDEBUG
//always open a console in debug mode
AllocConsole();
freopen("CONIN$", "r", stdin);
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
return;
#endif
if (OpenFlipper::Options::logToConsole())
{
AllocConsole();
freopen("CONIN$", "r", stdin);
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
}
}
}
{
//try to attach the console of the parent process
if (AttachConsole(-1))
{
//if the console was attached change stdinput and output
FILE* check = freopen("CONIN$", "r", stdin);
if (check) {
std::cerr << "Error reopening stdin" << std::endl;
}
check = freopen("CONOUT$", "w", stdout);
if (check) {
std::cerr << "Error reopening stdout" << std::endl;
}
check = freopen("CONOUT$", "w", stderr);
if (check) {
std::cerr << "Error reopening stderr" << std::endl;
}
}
else
{
//create and attach a new console if needed
#ifndef NDEBUG
//always open a console in debug mode
AllocConsole();
FILE* check = freopen("CONIN$", "r", stdin);
if (check) {
std::cerr << "Error reopening stdin" << std::endl;
}
ckeck = freopen("CONOUT$", "w", stdout);
if (check) {
std::cerr << "Error reopening stdout" << std::endl;
}
check = freopen("CONOUT$", "w", stderr);
if (check) {
std::cerr << "Error reopening stderr" << std::endl;
}
return;
#endif
if (OpenFlipper::Options::logToConsole())
{
AllocConsole();
FILE* check = freopen("CONIN$", "r", stdin);
if (check) {
std::cerr << "Error reopening stdin" << std::endl;
}
check = freopen("CONOUT$", "w", stdout);
if (check) {
std::cerr << "Error reopening stdout" << std::endl;
}
check = freopen("CONOUT$", "w", stderr);
if (check) {
std::cerr << "Error reopening stderr" << std::endl;
}
}
}
}
#endif
......
......@@ -146,7 +146,7 @@ RendererInfo* RenderManager::operator[](unsigned int _id) {
}
unsigned int RenderManager::available() {
size_t RenderManager::available() {
return availableRenderers_.size();
}
......@@ -280,7 +280,7 @@ PostProcessorInfo* PostProcessorManager::operator[](unsigned int _id ) {
}
unsigned int PostProcessorManager::available() {
size_t PostProcessorManager::available() {
return availablePostProcessors_.size();
}
......
......@@ -144,7 +144,7 @@ class DLLEXPORT RenderManager {
*
* @return number of available renderers
*/
unsigned int available();
size_t available();
/** \brief set the active renderer
*
......@@ -255,7 +255,7 @@ class DLLEXPORT PostProcessorManager {
*
* @return number of available post processor
*/
unsigned int available();
size_t available();
/** \brief set the active post processor for viewer
*
......
......@@ -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,
......
......@@ -1168,12 +1168,12 @@ bool glViewer::decodeView(const QString& _view,
// Parse the components
// first, get the projection and the modelview matrices
//*********************************************************
for (std::size_t i = 0; i < 4; ++i)
for (int i = 0; i < 4; ++i)
{
for (std::size_t j = 0; j < 4; ++j)
for (int j = 0; j < 4; ++j)
{
m(i,j) = split[i*4 + j].toDouble();
p(i,j) = split[i*4 + j +16].toDouble();
p(i,j) = split[i*4 + j +16 ].toDouble();
}
}
......@@ -1211,9 +1211,9 @@ bool glViewer::decodeView(const QString& _view,
// Parse the components
// first, get the projection and the modelview matrices
//*********************************************************
for (std::size_t i = 0; i < 4; ++i)
for (int i = 0; i < 4; ++i)
{
for (std::size_t j = 0; j < 4; ++j)
for (int j = 0; j < 4; ++j)
{
m(i,j) = split[i*4 + j].toDouble();
p(i,j) = split[i*4 + j +16].toDouble();
......@@ -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(),
......@@ -270,7 +270,7 @@ int glViewer::pickColor( ACG::SceneGraph::PickTarget _pickTarget,
rgba[2] = pixels[hit][2];
rgba[3] = pixels[hit][3];
std::vector<unsigned int> rv = properties_.glState().pick_color_to_stack (rgba);
std::vector<size_t> rv = properties_.glState().pick_color_to_stack (rgba);
// something wrong with the color stack ?
if (rv.size () < 2)
......@@ -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?
......@@ -394,7 +394,7 @@ int glViewer::pickFromCache( ACG::SceneGraph::PickTarget _pickTarget,
rgba[2] = pixels[hit][2];
rgba[3] = pixels[hit][3];
std::vector<unsigned int> rv = properties_.glState().pick_color_to_stack (rgba);
std::vector<size_t> rv = properties_.glState().pick_color_to_stack (rgba);
// something wrong with the color stack ?
if (rv.size () < 2)
......@@ -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)
{
......@@ -561,11 +561,11 @@ bool glViewer::pick_region( ACG::SceneGraph::PickTarget _pickTarg
rgba[2] = buffer[bPos + 2];
rgba[3] = buffer[bPos + 3];
std::vector<unsigned int> rv = properties_.glState().pick_color_to_stack (rgba);
std::vector<size_t> rv = properties_.glState().pick_color_to_stack (rgba);
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