Skip to content

Commit

Permalink
fix: Restore ABI compatibility with Coin v4.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
VolkerEnderlein committed Sep 5, 2024
1 parent eab55e7 commit 6fed2a8
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/Inventor/SoRenderManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ class COIN_DLL_API SoRenderManager {

private:
void attachRootSensor(SoNode * const sceneroot);
void attachClipSensor(SoNode * const sceneroot);
void detachRootSensor(void);
void detachClipSensor(void);
static void nodesensorCB(void * data, SoSensor *);
static void prerendercb(void * userdata, SoGLRenderAction * action);

Expand Down
56 changes: 56 additions & 0 deletions src/rendering/SoRenderManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,11 @@ SoRenderManager::SoRenderManager(void)

PRIVATE(this)->glaction = new SoGLRenderAction(SbViewportRegion(400, 400));
PRIVATE(this)->audiorenderaction = new SoAudioRenderAction;

PRIVATE(this)->clipsensor = NULL;
// new SoNodeSensor(SoRenderManagerP::updateClippingPlanesCB, PRIVATE(this));
//PRIVATE(this)->clipsensor->setPriority(this->getRedrawPriority() - 1);

}

/*!
Expand All @@ -291,6 +296,8 @@ SoRenderManager::~SoRenderManager()
delete PRIVATE(this)->superimpositions;
}

//delete PRIVATE(this)->clipsensor;

if (PRIVATE(this)->scene)
PRIVATE(this)->scene->unref();
this->setCamera(NULL);
Expand All @@ -309,6 +316,7 @@ SoRenderManager::~SoRenderManager()
void
SoRenderManager::setSceneGraph(SoNode * const sceneroot)
{
//this->detachClipSensor();
this->detachRootSensor();
// Don't unref() until after we've set up the new root, in case the
// old root == the new sceneroot. (Just to be that bit more robust.)
Expand All @@ -319,6 +327,7 @@ SoRenderManager::setSceneGraph(SoNode * const sceneroot)
if (PRIVATE(this)->scene) {
PRIVATE(this)->scene->ref();
this->attachRootSensor(PRIVATE(this)->scene);
//this->attachClipSensor(PRIVATE(this)->scene);
}

if (oldroot) oldroot->unref();
Expand Down Expand Up @@ -412,6 +421,38 @@ SoRenderManager::detachRootSensor(void)
}
}

/*
Attaches this SoRenderManagers clipsensor to a scene
\param[in] sceneroot scene to attach to
\deprecated Will not be available in Coin 5
*/
void
SoRenderManager::attachClipSensor(SoNode * const sceneroot)
{
//PRIVATE(this)->clipsensor->attach(sceneroot);
//if (PRIVATE(this)->autoclipping != SoRenderManager::NO_AUTO_CLIPPING) {
// PRIVATE(this)->clipsensor->schedule();
//}
}

/*
Detaches the clipsensor from all tracked scenes
\deprecated Will not be available in Coin 5
*/
void
SoRenderManager::detachClipSensor(void)
{
//if (PRIVATE(this)->clipsensor->isScheduled()) {
// PRIVATE(this)->clipsensor->unschedule();
//}
//if (PRIVATE(this)->clipsensor->getAttachedNode()) {
// PRIVATE(this)->clipsensor->detach();
//}
}

/*!
Clears buffers with the background color set correctly
Expand Down Expand Up @@ -942,6 +983,21 @@ void
SoRenderManager::setAutoClipping(AutoClippingStrategy autoclipping)
{
PRIVATE(this)->autoclipping = autoclipping;

//if (PRIVATE(this)->scene) {
// switch (autoclipping) {
// case SoRenderManager::NO_AUTO_CLIPPING:
// this->detachClipSensor();
// break;
// case SoRenderManager::FIXED_NEAR_PLANE:
// case SoRenderManager::VARIABLE_NEAR_PLANE:
// if (!PRIVATE(this)->clipsensor->getAttachedNode()) {
// PRIVATE(this)->clipsensor->attach(PRIVATE(this)->scene);
// }
// PRIVATE(this)->clipsensor->schedule();
// break;
// }
//}
}

/*!
Expand Down
9 changes: 9 additions & 0 deletions src/rendering/SoRenderManagerP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@ SoRenderManagerP::cleanup(void)
SoRenderManagerP::cleanupfunctionset = FALSE;
}

void
SoRenderManagerP::updateClippingPlanesCB(void * COIN_UNUSED_ARG(closure), SoSensor * COIN_UNUSED_ARG(sensor))
{
//SoRenderManagerP * thisp = (SoRenderManagerP *) closure;
//if (thisp->autoclipping != SoRenderManager::NO_AUTO_CLIPPING) {
// thisp->setClippingPlanes();
//}
}

void
SoRenderManagerP::setClippingPlanes(void)
{
Expand Down
2 changes: 2 additions & 0 deletions src/rendering/SoRenderManagerP.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class SoRenderManagerP {
~SoRenderManagerP();

void setClippingPlanes(void);
static void updateClippingPlanesCB(void * closure, SoSensor * sensor);
void getCameraCoordinateSystem(SbMatrix & matrix,
SbMatrix & inverse);
static void redrawshotTriggeredCB(void * data, SoSensor * sensor);
Expand Down Expand Up @@ -100,6 +101,7 @@ class SoRenderManagerP {
SbBool texturesenabled;
SbBool isrgbmode;
uint32_t redrawpri;
SoNodeSensor * clipsensor;

SoGetBoundingBoxAction * getbboxaction;
SoAudioRenderAction * audiorenderaction;
Expand Down

0 comments on commit 6fed2a8

Please sign in to comment.