Hi Simon,

for the small feature detection I do the following in the RenderAction 
perhaps this helps.

Andreas


bool RenderAction::isSmallFeature(const NodePtr &node)
{
     if(node == NullFC)
         return true;

     if(!_bSmallFeatureCulling)
         return false;

     //node->updateVolume();
     DynamicVolume vol = node->getVolume();
     vol.transform(top_matrix());

     Pnt3f p[8];
     vol.getBounds(p[0], p[4]);

     p[1].setValues(p[0][0], p[4][1], p[0][2]);
     p[2].setValues(p[4][0], p[4][1], p[0][2]);
     p[3].setValues(p[4][0], p[0][1], p[0][2]);

     p[5].setValues(p[4][0], p[0][1], p[4][2]);
     p[6].setValues(p[0][0], p[0][1], p[4][2]);
     p[7].setValues(p[0][0], p[4][1], p[4][2]);

     for(int i=0;i<8;++i)
         _worldToScreenMatrix.multFullMatrixPnt(p[i]);

     Pnt2f min(OSG::Inf, OSG::Inf);
     Pnt2f max(OSG::NegInf, OSG::NegInf);

     for(int i=0;i<8;++i)
     {
         if(p[i][0] < min[0])
             min[0] = p[i][0];

         if(p[i][1] < min[1])
             min[1] = p[i][1];

         if(p[i][0] > max[0])
             max[0] = p[i][0];

         if(p[i][1] > max[1])
             max[1] = p[i][1];
     }

     //for(int i=0;i<8;++i)
     //    printf("p%d: %f %f\n", i, p[i][0], p[i][1]);

     Real32 w = ((max[0] - min[0]) / 2.0f) * 
Real32(_viewport->getPixelWidth());
     Real32 h = ((max[1] - min[1]) / 2.0f) * 
Real32(_viewport->getPixelHeight());
     Real32 f = w * h;

     //printf("%f %f pixels: %f x %f = %f\n", max[0] - min[0], max[1] - 
min[1], w, h, f);

     if(f <= _smallFeaturesPixels)
         return true;

     return false;
}


> hi andreas
> 
> 
>>can you try to add
>>
>>sphereVol.transform(ra->top_matrix());
>>
>>before
>>
>>sphereVol.transform(matToScreen);
> 
> 
> thanks for the hint, unfortunately it makes no difference. i 
> thought that Camera::getWorldToScreen(..) should give me 
> coordinates in the range of -1..1, which then have to be scaled 
> with the viewport dimensions.
> 
> right now, the projected radius of the bounding sphere does not 
> change when tumbling/zooming the cam.
> 
> do i also have to apply RenderAction::getActNode()->getToWorld(..)?
> 
> thanks & regards,
> simon
> 
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Opensg-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/opensg-users
> 
> 


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to