From 6b486c109b6d89105c4cbe4ae0dc2ed0c72d27c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Fri, 24 Feb 2012 17:01:39 +0000 Subject: [PATCH] Update type update git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@13905 383ad7c9-94d9-4d36-a494-682f7c89f535 --- ObjectTypes/SplatCloud/SplatCloudNode.cc | 4 +- ObjectTypes/SplatCloud/SplatCloudObject.cc | 82 ++++++++++++++++++++ ObjectTypes/SplatCloud/SplatCloudObject.hh | 4 + Plugin-TypeSplatCloud/TypeSplatCloud.cc | 89 ---------------------- Plugin-TypeSplatCloud/TypeSplatCloud.hh | 1 - 5 files changed, 88 insertions(+), 92 deletions(-) diff --git a/ObjectTypes/SplatCloud/SplatCloudNode.cc b/ObjectTypes/SplatCloud/SplatCloudNode.cc index 2cf4d1a1b..34d549768 100644 --- a/ObjectTypes/SplatCloud/SplatCloudNode.cc +++ b/ObjectTypes/SplatCloud/SplatCloudNode.cc @@ -401,7 +401,7 @@ void SplatCloudNode::rebuildVBO( GLState &_state ) if( splatCloud_.hasPointsizes() ) { pointsizesOffset = size; size += numPoints * 4; } if( splatCloud_.hasColors() ) { colorsOffset = size; size += numPoints * 3; } if( splatCloud_.hasSelections() ) { selectionsOffset = size; size += numPoints * 4; } - /* has pick colors = true */ { pickColorsOffset = size; size += numPoints * 4; } + /* has pick colors = true */ { pickColorsOffset = size; size += numPoints * 4; } // tell GL that we are seldomly updating the VBO but are often drawing it glBufferDataARB( GL_ARRAY_BUFFER_ARB, size, 0, GL_STATIC_DRAW_ARB ); @@ -642,7 +642,7 @@ void SplatCloudNode::rebuildVBOSelections() void SplatCloudNode::rebuildVBOPickColors( GLState &_state ) { - if( vboPickColorsOffset_ == -1 ) + if( vboPickColorsOffset_ == -1 || !splatCloud_.hasPoints() ) return; # ifdef REPORT_VBO_UPDATES diff --git a/ObjectTypes/SplatCloud/SplatCloudObject.cc b/ObjectTypes/SplatCloud/SplatCloudObject.cc index f89049981..2c9ecf791 100644 --- a/ObjectTypes/SplatCloud/SplatCloudObject.cc +++ b/ObjectTypes/SplatCloud/SplatCloudObject.cc @@ -61,6 +61,12 @@ #include +//== DEFINES ===================================================== + + +//#define REPORT_UPDATE_TYPE + + //== IMPLEMENTATION ============================================== @@ -429,6 +435,82 @@ void SplatCloudObject::init( const SplatCloud *_splatCloud ) } +//---------------------------------------------------------------- + + +/** + * Update object and scenegraph nodes + */ +void SplatCloudObject::update( UpdateType _type ) +{ + if( _type == UPDATE_ALL ) + { +# ifdef REPORT_UPDATE_TYPE + std::cout << "SplatCloudObject::update() : UPDATE_ALL" << std::endl; + std::cout << std::endl; +# endif + + if( splatCloudNode_ ) + splatCloudNode_->modifiedAll(); + return; + } + + if( _type.contains( UPDATE_GEOMETRY ) ) + { +# ifdef REPORT_UPDATE_TYPE + std::cout << "SplatCloudObject::update() : UPDATE_GEOMETRY" << std::endl; +# endif + + if( splatCloudNode_ ) + splatCloudNode_->modifiedPoints(); + } + + if( _type.contains( updateType("Normals") ) ) + { +# ifdef REPORT_UPDATE_TYPE + std::cout << "SplatCloudObject::update() : UPDATE_Normals" << std::endl; +# endif + + if( splatCloudNode_ ) + splatCloudNode_->modifiedNormals(); + } + + if( _type.contains( updateType("Pointsizes") ) ) + { +# ifdef REPORT_UPDATE_TYPE + std::cout << "SplatCloudObject::update() : UPDATE_Pointsizes" << std::endl; +# endif + + if( splatCloudNode_ ) + splatCloudNode_->modifiedPointsizes(); + } + + if( _type.contains( UPDATE_COLOR ) ) + { +# ifdef REPORT_UPDATE_TYPE + std::cout << "SplatCloudObject::update() : UPDATE_COLOR" << std::endl; +# endif + + if( splatCloudNode_ ) + splatCloudNode_->modifiedColors(); + } + + if( _type.contains( UPDATE_SELECTION ) ) + { +# ifdef REPORT_UPDATE_TYPE + std::cout << "SplatCloudObject::update() : UPDATE_SELECTION" << std::endl; +# endif + + if( splatCloudNode_ ) + splatCloudNode_->modifiedSelections(); + } + +# ifdef REPORT_UPDATE_TYPE + std::cout << std::endl; +# endif +} + + //---------------------------------------------------------------- // Name/Path Handling //---------------------------------------------------------------- diff --git a/ObjectTypes/SplatCloud/SplatCloudObject.hh b/ObjectTypes/SplatCloud/SplatCloudObject.hh index 8a0a54dd4..d162b8d3e 100644 --- a/ObjectTypes/SplatCloud/SplatCloudObject.hh +++ b/ObjectTypes/SplatCloud/SplatCloudObject.hh @@ -120,6 +120,10 @@ protected: /// Initialise current Object, including all related Nodes virtual void init( const SplatCloud *_splatCloud = 0 ); +public: + /// Called by the core if the object has to be updated + void update( UpdateType _type = UPDATE_ALL ); + //-------------------------------- /** @name Name and Path handling * @{ */ diff --git a/Plugin-TypeSplatCloud/TypeSplatCloud.cc b/Plugin-TypeSplatCloud/TypeSplatCloud.cc index 0a6cadbab..5a396d96e 100644 --- a/Plugin-TypeSplatCloud/TypeSplatCloud.cc +++ b/Plugin-TypeSplatCloud/TypeSplatCloud.cc @@ -60,12 +60,6 @@ #include -//== DEFINES ===================================================== - - -//#define REPORT_UPDATE_TYPE - - //== IMPLEMENTATION ============================================== @@ -196,89 +190,6 @@ void TypeSplatCloudPlugin::slotViewChanged() //---------------------------------------------------------------- -void TypeSplatCloudPlugin::slotObjectUpdated( int _objectId, const UpdateType& _type ) -{ - if( _objectId == -1 ) - return; - - BaseObjectData *object = 0; - PluginFunctions::getObject( _objectId, object ); - - // Groups are not BaseObjectData, so this will fail. - if ( !object ) - return; - - SplatCloudNode *splatCloudNode = PluginFunctions::splatCloudNode( object ); - - if( splatCloudNode ) - { - - if( _type == UPDATE_ALL ) - { -# ifdef REPORT_UPDATE_TYPE - std::cout << "TypeSplatCloudPlugin::slotObjectUpdated() : UPDATE_ALL" << std::endl; - std::cout << std::endl; -# endif - - splatCloudNode->modifiedAll(); - return; - } - - if( _type.contains( UPDATE_GEOMETRY ) ) - { -# ifdef REPORT_UPDATE_TYPE - std::cout << "TypeSplatCloudPlugin::slotObjectUpdated() : UPDATE_GEOMETRY" << std::endl; -# endif - - splatCloudNode->modifiedPoints(); - } - - if( _type.contains( updateType("Normals") ) ) - { -# ifdef REPORT_UPDATE_TYPE - std::cout << "TypeSplatCloudPlugin::slotObjectUpdated() : UPDATE_Normals" << std::endl; -# endif - - splatCloudNode->modifiedNormals(); - } - - if( _type.contains( updateType("Pointsizes") ) ) - { -# ifdef REPORT_UPDATE_TYPE - std::cout << "TypeSplatCloudPlugin::slotObjectUpdated() : UPDATE_Pointsizes" << std::endl; -# endif - - splatCloudNode->modifiedPointsizes(); - } - - if( _type.contains( UPDATE_COLOR ) ) - { -# ifdef REPORT_UPDATE_TYPE - std::cout << "TypeSplatCloudPlugin::slotObjectUpdated() : UPDATE_COLOR" << std::endl; -# endif - - splatCloudNode->modifiedColors(); - } - - if( _type.contains( UPDATE_SELECTION ) ) - { -# ifdef REPORT_UPDATE_TYPE - std::cout << "TypeSplatCloudPlugin::slotObjectUpdated() : UPDATE_SELECTION" << std::endl; -# endif - - splatCloudNode->modifiedSelections(); - } - -# ifdef REPORT_UPDATE_TYPE - std::cout << std::endl; -# endif - } -} - - -//---------------------------------------------------------------- - - bool TypeSplatCloudPlugin::registerType() { addDataType( "SplatCloud", tr( "SplatCloud" ) ); diff --git a/Plugin-TypeSplatCloud/TypeSplatCloud.hh b/Plugin-TypeSplatCloud/TypeSplatCloud.hh index b9ce54bcd..73e888b08 100644 --- a/Plugin-TypeSplatCloud/TypeSplatCloud.hh +++ b/Plugin-TypeSplatCloud/TypeSplatCloud.hh @@ -91,7 +91,6 @@ private slots: // -- Base Inferface -- void noguiSupported() { } void slotViewChanged(); - void slotObjectUpdated( int _objectId, const UpdateType& _type ); public: -- GitLab