Hi all,
I want to get the size of a text, in order to put a dark, semi-transparent,
backface to highlight
it. I put a SoTimerSensor scheduled each second, and in it, I retrieve the
group, and the BBox.
Here's the result I get (the max changes and when I move the camera, everything
change) :
faceSet found at 83b0a08 : bbox : [ 598415.375000, 129853.562500, 31.537935 ]
- [ 598561.437500,
129872.437500, 81.537933 ]
faceSet found at 83b0a08 : bbox : [ 598417.375000, 129853.562500, 31.537933 ]
- [ 1197052.750000,
259735.500000, 81.537933 ]
faceSet found at 83b0a08 : bbox : [ 598417.375000, 129853.562500, 31.537933 ]
- [ 1795544.125000,
389598.562500, 81.537933 ]
faceSet found at 83b0a08 : bbox : [ 598417.375000, 129853.562500, 31.537935 ]
- [ 2394035.500000,
519461.625000, 81.551270 ]
faceSet found at 83b0a08 : bbox : [ 598417.375000, 129853.562500, 31.537935 ]
- [ 2992527.000000,
649324.750000, 81.555710 ]
faceSet found at 83b0a08 : bbox : [ 598417.375000, 129853.562500, 31.537935 ]
- [ 3591018.500000,
779187.812500, 81.560158 ]
faceSet found at 83b0a08 : bbox : [ 598417.375000, 129853.562500, 31.537935 ]
- [ 4189510.000000,
909050.875000, 81.564606 ]
faceSet found at 83b0a08 : bbox : [ 598417.375000, 129853.562500, 31.537933 ]
- [ 4788001.500000,
1038913.937500, 81.537933 ]
faceSet found at 83b0a08 : bbox : [ 598417.375000, 129853.562500, 31.537935 ]
- [ 5386493.000000,
1168777.000000, 81.573494 ]
faceSet found at 83b0a08 : bbox : [ 598417.375000, 129853.562500, 31.537935 ]
- [ 5984984.500000,
1298640.000000, 81.577942 ]
faceSet found at 83b0a08 : bbox : [ 598417.375000, 129853.562500, 31.537933 ]
- [ 6583476.000000,
1428503.000000, 81.537933 ]
faceSet found at 83b0a08 : bbox : [ 598417.375000, 129853.562500, 31.537935 ]
- [ 7181967.500000,
1558366.000000, 81.586830 ]
faceSet found at 83b0a08 : bbox : [ 598417.375000, 129853.562500, 31.537935 ]
- [ 7780459.000000,
1688229.000000, 81.591278 ]
faceSet found at 83b0a08 : bbox : [ 598417.375000, 129853.562500, 31.537933 ]
- [ 8378950.500000,
1818092.000000, 81.537933 ]
faceSet found at 83b0a08 : bbox : [ 598417.375000, 129853.562500, 31.537933 ]
- [ 8977442.000000,
1947955.000000, 81.537933 ]
// here"s when I move the camera once -> the min change.
faceSet found at 83b0a08 : bbox : [ 598416.750000, -19331.015625,
-592481.250000 ] - [
9607957.000000, 1985220.750000, 38133.164062 ]
faceSet found at 83b0a08 : bbox : [ 598088.750000, -49006.812500,
-214097.671875 ] - [
10238736.000000, 2103215.500000, 42885.589844 ]
changing factor for node 0 : A = 0.013750, B = 1.250000, y = 13.281250, len =
0.000000,
faceSet found at 83b0a08 : bbox : [ 593136.187500, -1032557.062500,
-55820.386719 ] - [
11003241.000000, 2186615.250000, 376706.531250 ]
here's the code from within the callback :
// Get the Path, to have the parent group, and the the BBox
SoSearchAction mySearch;
SoFaceSet * pFaceSet = (SoFaceSet*)pThis->backfaceList[i];
#ifdef DEBUG
printf( "faceSet found at %x : ", pFaceSet );
#endif
mySearch.reset();
mySearch.setNode( pFaceSet );
mySearch.setFind( SoSearchAction::NODE );
mySearch.setInterest( SoSearchAction::FIRST );
mySearch.apply( pThis->pRootGroup );
const SoPath * pPath = mySearch.getPath();
if (pPath != NULL)
{
// Getting the father
SoNode * pGroupText = pPath->getNodeFromTail(1);
// Getting the BBox
SbViewportRegion view;
SoGetBoundingBoxAction getBB(view);
getBB.apply( pGroupText );
const SbVec3f & min = getBB.getBoundingBox().getMin();
const SbVec3f & max = getBB.getBoundingBox().getMax();
#ifdef DEBUG
printf( " bbox : [ %f, %f, %f ] - [ %f, %f, %f ]\n", min[0], min[1],
min[2], max[0], max[1],
max[2] );
#endif
I don't know what cause this strange behaviour, but I cannot acces the root
node.
any clue ???
Cyril ZEKSER
VISIOSPACE
|