From what I've read in specs each scene element form XML3D has bounding box associated with it.
I would like to ask how is the size of bounding boxes calculated?
Especially for the <group>
and <xml3d>
elements - does it take into consideration the sizes of children's bounding boxes?
I assume that bounding box size for <mesh>
is calculated from mesh vertices positions.
I need this knowledge to tweak camera translation speed.
As you guessed on
<mesh>
elements it's calculated from the vertex positions. For<group>
elements it's basically calculated as follows:So it recurses until it hits
<mesh>
elements and the resulting bounding box for each group in the hierarchy is the smallest volume that encloses the bounding boxes of all the child elements, whether they be<groups>
or<meshes>
. A<group>
with no renderable objects (<mesh>
or<model>
) anywhere in its subtree will return an empty box.On the
<xml3d>
element it will return a box that encloses the entire scene.One thing to remember is that objects marked as invisible (with the visible="false" attribute) won't be included in the bounding box calculations.