write custom action class to notify shape node about vbo changes

This commit is contained in:
wmayer
2017-02-11 16:16:26 +01:00
parent 4a0720dd00
commit fe15db6af3
6 changed files with 134 additions and 40 deletions

View File

@@ -821,6 +821,71 @@ SbBool SoVisibleFaceAction::isHandled() const
// ---------------------------------------------------------------
SO_ACTION_SOURCE(SoUpdateVBOAction);
/**
* The order of the defined SO_ACTION_ADD_METHOD statements is very important. First the base
* classes and afterwards subclasses of them must be listed, otherwise the registered methods
* of subclasses will be overridden. For more details see the thread in the Coin3d forum
* https://www.coin3d.org/pipermail/coin-discuss/2004-May/004346.html.
* This means that \c SoSwitch must be listed after \c SoGroup and \c SoFCSelection after
* \c SoSeparator because both classes inherits the others.
*/
void SoUpdateVBOAction::initClass()
{
SO_ACTION_INIT_CLASS(SoUpdateVBOAction,SoAction);
SO_ENABLE(SoUpdateVBOAction, SoSwitchElement);
SO_ACTION_ADD_METHOD(SoNode,nullAction);
SO_ENABLE(SoUpdateVBOAction, SoModelMatrixElement);
SO_ENABLE(SoUpdateVBOAction, SoProjectionMatrixElement);
SO_ENABLE(SoUpdateVBOAction, SoCoordinateElement);
SO_ENABLE(SoUpdateVBOAction, SoViewVolumeElement);
SO_ENABLE(SoUpdateVBOAction, SoViewingMatrixElement);
SO_ENABLE(SoUpdateVBOAction, SoViewportRegionElement);
SO_ACTION_ADD_METHOD(SoCamera,callDoAction);
SO_ACTION_ADD_METHOD(SoCoordinate3,callDoAction);
SO_ACTION_ADD_METHOD(SoCoordinate4,callDoAction);
SO_ACTION_ADD_METHOD(SoGroup,callDoAction);
SO_ACTION_ADD_METHOD(SoSwitch,callDoAction);
SO_ACTION_ADD_METHOD(SoShape,callDoAction);
SO_ACTION_ADD_METHOD(SoIndexedFaceSet,callDoAction);
SO_ACTION_ADD_METHOD(SoSeparator,callDoAction);
SO_ACTION_ADD_METHOD(SoFCSelection,callDoAction);
}
SoUpdateVBOAction::SoUpdateVBOAction ()
{
SO_ACTION_CONSTRUCTOR(SoUpdateVBOAction);
}
SoUpdateVBOAction::~SoUpdateVBOAction()
{
}
void SoUpdateVBOAction::finish()
{
atexit_cleanup();
}
void SoUpdateVBOAction::beginTraversal(SoNode *node)
{
traverse(node);
}
void SoUpdateVBOAction::callDoAction(SoAction *action,SoNode *node)
{
node->doAction(action);
}
// ---------------------------------------------------------------
namespace Gui {
class SoBoxSelectionRenderActionP {
public: