BoundingSphere bug

Is this the apropriate place to post bugs? (found no bug tracker)

So here is one:



Effect:

E.g. the whole world is culled if the only visible things contain the camera in their bounding spheres.



Details:

In BoundingSphere.java, in method

private BoundingVolume merge(float temp_radius, Vector3f temp_center, BoundingSphere rVal)


the sphere including both volumes was computed incorrectly:

        if (fRDiffSqr >= lengthSquared) {
            if (radiusDiff >= 0.0f) {
                return this;
            } else {
                return rVal;
            }
        }


did not do anything if the temporary sphere included 'this'. It can be corrected like this:

        if (fRDiffSqr >= lengthSquared) {
            if (radiusDiff <= 0.0f) {
                return this;
            }
           else
            {
               rVal.setCenter( temp_center );
               rVal.setRadius( temp_radius );
               return rVal;
            }
        }



/Irrisor

Still seems wrong after testing your changes. But we do know about BoundingSphere issues and will get fixes on those soon.

This probably does not solve all bugs, but it solves this:

       Sphere child = new Sphere( "test1", 20, 20, 2 );
       child.setModelBound( new BoundingSphere( 2, new Vector3f() ) );
       rootNode.attachChild( child );
       rootNode.attachChild( new Skybox( "test2", 3, 3, 3 ));


Looks like this without patch:

With patch the scene is contained in the outer bounding sphere:



/Irrisor