Commit 6b486c10 authored by Jan Möbius's avatar Jan Möbius
Browse files

Update type update



git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@13905 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 5a4a9c89
......@@ -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
......
......@@ -61,6 +61,12 @@
#include <QString>
//== 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
//----------------------------------------------------------------
......
......@@ -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
* @{ */
......
......@@ -60,12 +60,6 @@
#include <ACG/GL/GLState.hh>
//== 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" ) );
......
......@@ -91,7 +91,6 @@ private slots:
// -- Base Inferface --
void noguiSupported() { }
void slotViewChanged();
void slotObjectUpdated( int _objectId, const UpdateType& _type );
public:
......
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